Training Methods and Some Interesting Data
Last night Sam, Alex, James, and Oliver finished writing the code for the majority of the app. We have completed recording functionality, Weka training functionality, and have completed the code to receive predictions from Weka. Our next step is to choose a feature (i.e Mean, RMS, Median) to help filter our data so that we can process fewer readings but more significant ones. Once we start playing with features, we will have to record highly controlled data so that we can build a comparison that allows us to measure the accuracy of our prediction feature by comparing the filtered data versus the raw data. Doing so will allow us to choose the best feature to operate on our data.
Initial App Finished
Now that the basic code for the app is finished, we decided to take the app for a spin and do some training. To begin we recorded some data for walking and sitting (sitting consisted of just being in a seat and using your phone, not the act of sitting down. After some playing around and some more training, we added stairs to the data and recorded a few of us walking down the stairs several times. After training, we attempted some predictions, the predictions are given to the user live while the sensors are recording.
The initial problem we noticed was that when we took the predictor for a walk, the label kept switching between walking and taking the stairs. We made the initial assumption that this was happening because we needed to record more data so the training can experience more test cases. However upon closer inspection, we noticed that simply tilting the phone to the position it was held during recording, we could access all 3 states that had been recorded so far (sitting, walking, stairs). This made us think that the gyroscope readings are having more of an influence on the models than the accelerometer readings. We think that we need to find a way to filter the data so the models are less prone to this bias.
Figure 1.8 - Main Menu, Recording a State, Writing to File, Predicting State
Training Method
In order to train the data, we are going to test 2 main training methods; kNN and Bayes Net.
As an overview, kNN refers to k-nearest neighbours. KNN is an algorithm that predicts the class for an unclassified object. For example, in the diagram below (sourced from http://adataanalyst.com/machine-learning/knn/) there are two classes; A and B. In the example, we have an unknown object which is shown by the star. The kNN algorithm is used to classify this point as either class A or class B based on the k closest points. If k = 3, then the point will be classified as class B as there are more class B points than there are class A (2 compared to 1). However, if k was larger such as k = 6, the point will be classified as class A (4 class A points compared to 2 class B points). In summary, the object is classified by a majority vote of its neighbours.
The algorithm:
- Measure the distance between the unclassified object and every other point in our database
- Find the k nearest neighbours
- Take a summary statistic to identify the class of the unknown object. (For classification, this will be the majority class and for regression, this will be the mean of the k nearest neighbours).
Bayes Network
The Bayesian Network is a graphical notation to represent dependencies and conditional independence between variables. A bayes network consists of nodes which represent the random variables in the domain. A directed arc between any 2 nodes represents a relationship of direct influence and describes the cause to the effect. For example, in the below bayes network (Simplified)
- Weather and Cavity are not dependent on anything else as there is no parent node
- Toothache and Catch directly depend on Cavity (conditionally independent given a cavity has occurred)
- Toothache and Catch are independent of each other
- Probe_breaks depends directly on Catch but indirectly on Cavity
In relation to our sensors, the nodes that represent the random variables in the domain will represent our values and these nodes will link to each of the 5 states that we have chosen.
Written by Celine, James, and Sam
Comments
Post a Comment