Implementation of KNN algorithm in Python 3 for prediction of Target class.
- K-Nearest-Neighbors algorithm is used for classification and regression both.
- In this project, it is used for classification.
- Classified dataset used to predict target class.
- CSV (Comma Separated Values) format.
- Attributes can be integer or real values.
- Responses can be integer, real or categorical.
The primary goal is to predict target class based on multiple independent variable.
- pandas, numpy, matplotlib,seaborn,sklearn,joblib used in project
-
- followed indistry standard practice of machine learning life cycle steps.
-
- implement necessary transformation, preprocessing of dataset.
- conduct exploratory data analysis on dataset.
-
- visualised data using visualisation library like matplotlib, seaborn.
-
- scikit library use for KNN algorithm.
-
- model validate with accuracy score of diff K, confusion metrix.
-
- joblib library used to dump model.
- model is saved in .ipynb formate as i_phone_purchase_product_using_KNN_model.
- K value by standard method is 31.
- K value by error method is 18 , so we considered 17 or 19 as odd number.
- model build with all k values and checked accuracy score and confusion metrix.
- with K=31, accuracy score is 94.5%
- with k=17, accuracy score is 95.5%
- with k= 19, accuracy score is 96.5%
- so accuracy in k=19 is better, so this model is saved and loaded to predict.