Creating a model class for classification tasks using the nearest neighbor algorithm. We have created a machine learning method that does not make use of sklearn.
We have data from the website of a real estate agency. The target variable is air conditioner: apartment has air conditioner-(1); no air conditioner-(0).
We have created a class NearestNeighborClassificator
which contains methods fit()
and predict()
. fit()
stores the entire training set while predict()
uses the nearest_neighbor_predict()
function to predict the value.