CPU specifications: Intel Core
i5-5200U CPU @2.20GHz
RAM specifications: 8.00 GB
Packages used. numpy,tensorflow
tf.estimator(class of tensorflow)
Defined in: tensorflow/python/estimator/estimator.py.
Function: Estimator class to train and evaluate TensorFlow models.
The Estimator object wraps a model specified by a model_fn, in which the input
is fed and along with other parameters, results the ops for training the set,
determination of accuracy, or predictions.
this work we have used Parkinsons
Telemonitoring Data Set1 from UCI Machine Learning Repository. This data
set is composed of a range of biomedical voice measurements from 42 people with
early-stage Parkinson’s disease recruited to a six-month trial of a
telemonitoring device for remote symptom progression monitoring. The recordings
were automatically captured in the patient’s homes.
Columns in the table contain subject number, subject age, subject gender, time
interval from baseline recruitment date, motor UPDRS, total UPDRS, and 16
biomedical voice measures. The rows constitute 5,875 voice recordings of these
patients. The objective of the dataset is to predict the motor and total UPDRS
scores (‘motor_UPDRS’ and ‘total_UPDRS’) from the 16 voice measures.
The data is in ASCII CSV format. Each row of the CSV file contains an instance
corresponding to one voice recording of each individual. There are around 200
recordings per patient, the subject number of the patient is identified in the
– Integer that uniquely identifies each subject
age – Subject age
sex – Subject gender ‘0’ – male, ‘1’ – female
test_time – Time since recruitment into the trial. The integer part is the
number of days since recruitment.
motor_UPDRS – Clinician’s motor UPDRS score, linearly interpolated
total_UPDRS – Clinician’s total UPDRS score, linearly interpolated
Jitter(%),Jitter(Abs),Jitter:RAP,Jitter:PPQ5,Jitter:DDP – Several measures of
variation in fundamental frequency.
– Several measures of variation in amplitude
NHR,HNR – Two measures of ratio of noise to tonal components in the voice
RPDE – A nonlinear dynamical complexity measure
DFA – Signal fractal scaling exponent
PPE – A nonlinear measure of fundamental frequency variation
We have normalised our dataset using min-max normalization, the formula for the
= (Col. Value – minimum
value for that column)/( maximum value for that column- minimum value for that
Normalization of data means adjusting values which has been measured on
different scales to a typically accepted common scale, generally done prior to
Min-max normalisation is often known as feature scaling. Here the values of a
numeric range of an attribute of dataset, commonly called a property, are
reduced to a scale between between 0 and 1.
The tasks to be performed are:
1.Load CSVs containing UPDRS training/test data into a TensorFlow Dataset
2.Construct a neural network classifier
3.Train the model using the training data
4.Evaluate the accuracy of the model
The tf.estimator API uses input functions, which create the TensorFlow
operations that generate data for the model. We can use
tf.estimator.inputs.numpy_input_fn to produce the input pipeline
Fit the DNNClassifier to the Training
Pass train_input_fn as the input_fn, and the
number of steps to train (here, 2000):
# Train model.
The state of the model is preserved in the classifier. It can be train
iteratively if need exists. The above code is equivalent to the following:
Evaluate Model Accuracy
Like train, evaluate takes an input function that builds its input pipeline.
evaluate returns a dict with the evaluation results.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from six.moves.urllib.request import urlopen
import numpy as np
import tensorflow as tf
# Data sets
TRAINING = “Training-TotalUPDRS01.csv”
TEST = “Test-TotalUPDRS01.csv”
# Load datasets.
training_set = tf.contrib.learn.datasets.base.load_csv_with_header(
test_set = tf.contrib.learn.datasets.base.load_csv_with_header(
# Specify that all features have
# Build 3 layer DNN with 10, 20, 10
hidden_units=10, 20, 10,
# Define the training inputs
# Train model.
# Define the test inputs
test_input_fn = tf.estimator.inputs.numpy_input_fn(
print (“test input
# Evaluate accuracy.
accuracy_score = classifier.evaluate(input_fn=test_input_fn)”accuracy”