Skip to content

rishh19/ML_CLASS_CSE11_Task9

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‚ KNN Classification (From Scratch)

πŸ“ Description

This notebook demonstrates the mathematical implementation of K-Nearest Neighbors (KNN) without relying on pre-built machine learning model classes. It builds the algorithm logic entirely using NumPy to understand the underlying mechanics of distance-based classification.

πŸ”§ Key Features

  • Custom Algorithm: Implements a KNN_Scratch class with:
    • Euclidean Distance calculation (sqrt(sum(diff^2))).
    • Neighbor sorting and Majority Voting.
  • Manual Metrics: explicitly calculates True Positives (TP), False Positives (FP), True Negatives (TN), and False Negatives (FN) to derive Precision, Recall, Specificity, and NPV.
  • Visualization: Plots the manually generated Confusion Matrix using Seaborn.

πŸ“¦ Dependencies

  • pandas (for data loading)
  • numpy (for matrix operations)
  • matplotlib & seaborn (for plotting graphs only)

About

Implement KNN algorithm from scratch using NumPy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published