KNN_Backpropagation_Assignment
KNN_Backpropagation_Assignment
Introduction
K-Nearest Neighbour (KNN) is a simple, supervised machine learning algorithm. It assumes that
data points that are close in the feature space are similar.
Working of KNN
2. Calculate the distance (Euclidean or others) between the test data and all training data.
4. Classify the test data by majority voting among the k nearest neighbours.
Given data:
Apple | 150 |0
Apple | 160 |0
Orange | 140 |1
Orange | 170 |1
- Weight = 155g
- Texture = 0 (Smooth)
Step 2: Choose k = 3
Majority = Apple
2. Backpropagation Algorithm
Introduction
Backpropagation is the method of updating the weights of a neural network by minimizing the output
Steps in Backpropagation
2. Error Calculation: Find the difference between actual output and predicted output.
3. Backward Pass: Compute gradients using the chain rule.
Given:
- Input x = 1.0
Conclusion
- KNN predicts the output by finding nearest neighbours and using voting.