Aam Vaishaa-1
Aam Vaishaa-1
301
2. 304
3. 309
4. 320
GOVERNMENT POLYTECHNIC, AMBAD.
DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND
MACHINE LEARNING
COURSE & CODE-AIML/22683
CERTIFICATE
This is to certify that the Micro-project entitled “K-Nearest Neighbors Algorithm ” being
submitted here with for the award of DIPLOMA IN ENGINEERING & TECHNOLOGY
in Artificial Intelligence And Machine Learning of MAHARASHTRA STATE BOARD
OF TECHNICAL EDUCATION (MSBTE) is the result of Micro-
project work completed by All Group Members under the supervision and guidance of
Prof. P.T.Zunjare It is to the best of my knowledge and belief that the work embodied in
this Micro-project has not formed earlier the basis for the award of any degree or diploma
of this or any other Board or examining body.
Place: Ambad
Date:
2
DECLARATION
I, the undersigned hereby declare that the project entitled “K-Nearest Neighbors
Algorithm” is written and submitted by me to Government Polytechnic Ambad during
Year 2023-24, sixth Semester for partial fulfillment of the ‘Micro Project’ requirement of
‘Artificial Intelligence and Machine Learning’ course under Maharashtra State Board of
Technical Education, Mumbai curriculum, under the guidance of Prof.P.T.Zunjare is my
original work.
The empirical findings in this project are based on the collected data and are not copied
from any other sources.
3
ACKNOWLEDGEMENTS
Yours Sincerely ,
4
INDEX
1. Introduction 1
5. Implementation Of Project 8
6. Conclusion 9
7. Reference 10
5
INTRODUCTION
Imagine you have a group of students, and you know their favorite subjects. Now, a
new student joins, and you want to guess what their favorite subject might be. You
can look at a few students who are most similar to the new one (like in age, marks, or
hobbies), and see what their favorite subject is. If most of them like Math, you can
guess that the new student might like Math too. That’s how kNN works.
In kNN:
It compares things using distance, like how close or similar they are.
It works well when things that are alike are also close to each other.
kNN is very easy to understand and use, which makes it great for beginners in
machine learning.
6
OBJECTIVES OF THE PROJECT
FUTURE SCOPE
7
IMPLEMENTATION OF PROJECT
1. Data Collec on: Choose a relevant dataset (e.g., Iris, MNIST, or custom
dataset).
4. Model Evalua on: Use metrics like accuracy, confusion matrix, and ROC
curve to analyze performance.
8
1. Impor ng the modules
import numpy as np
import pandas as pd
2. Crea ng Dataset
plt.style.use('seaborn')
plt.figure(figsize = (10,10))
plt.sca er(X[:,0], X[:,1], c=y, marker= '*',s=100,edgecolors='black')
plt.show()
9
6. Predic ons for the KNN Classifiers
knn5.fit(X_train, y_train)
knn1.fit(X_train, y_train)
y_pred_5 = knn5.predict(X_test)
y_pred_1 = knn1.predict(X_test)
plt.subplot(1,2,2)
plt.sca er(X_test[:,0], X_test[:,1], c=y_pred_1, marker= '*',
s=100,edgecolors='black')
plt. tle("Predicted values with k=1", fontsize=20)
plt.show()
10
11
CONCLUSION
REFERENCE
https://www.appliedaicourse.com
https://www.ibmbigdatahub.com/
https://www.coursera.org
https://www.w3schools.com
https://www.tpointtech.com
12