Step 3 - Loading and parsing the training and test set

Now let's load the dataset. I am assuming that you copied your dataset to the UCI_HAR_Dataset/ directory. Then, also place the other data files as described previously:

val datasetPath = "UCI_HAR_Dataset/" 
val trainDataPath = s"$datasetPath/train/Inertial Signals" 
val trainLabelPath = s"$datasetPath/train/y_train.txt" val testDataPath = s"$datasetPath/test/Inertial Signals" 
val testLabelPath = s"$datasetPath/test/y_test.txt" 

Now it's time to load the training and test set separately. To do this I wrote two methods called loadData() and loadLabels() that are in the Utils.scala file. These two methods and their signatures will be provided soon:

val trainData = Utils.loadData(trainDataPath, ...

Get Scala Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.