Classifier--neatest centroid
(Note : The code pertaining this page is "knn_centroid.py" on our submitted github)
As we described before in Detailed Description page, nearest centroid machine learning algorithm classifies a testing data point by assigning it to the class of its nearest centroid. In our analysis, we got three attributes, in other words, three coordinates, which will form a three dimensional Euclidean Space, as shown in the graph below.
As we described before in Detailed Description page, nearest centroid machine learning algorithm classifies a testing data point by assigning it to the class of its nearest centroid. In our analysis, we got three attributes, in other words, three coordinates, which will form a three dimensional Euclidean Space, as shown in the graph below.
We collected data from four different places, so there would be four categories(classes) these data points belong to. Each class would form a cluster in the Euclidean space, and each cluster will possess a centroid. When the testing data point comes in, the model will find a nearest centroid from the four and allocate the data point to that class.
Practice
The way we developed this machine learning model is simple. We wrote a python code which you can get from our submitted code, exploiting sklearn.neighbors library to train our model. After that, users can give three input arguments (air quality, temperature, dust concentration) for the place they currently stayed, and the model will classify the arguments the users input, in other words, predicting where they are.
Of course, in order to get these attributes, you first need to have the devices. If you get that, just give the model three corresponding arguments in an integer type, it will look like :
Of course, in order to get these attributes, you first need to have the devices. If you get that, just give the model three corresponding arguments in an integer type, it will look like :
In the test sample above, the air quality index is 15, temperature is Celsius 20 degree and dust concentration is 300 (the device didn't restrict the concentration number to 100%) , the model told you you are probably in a "bathroom".