Git Product home page Git Product logo

knn-classifier's Introduction

KNN-Classifier

K Nearest Neighbors classifier from scratch for image classification using MNIST Data Set. KNN_Classifier

Implementation

No existing class or functions (e.g., sklearn.neighbors.KNeighborsClassifier) have been used.

Data Set:

MNIST data set consisting of 60000 examples where each example is a hand written digit. Each example includes 28x28 grey-scale pixel values as features and a categorical class label out of 0-9.

Data set can be manually download the dataset from Dr. Yann Lecun’s webpage or automatically import it from libraries/packages (e.g., as done in section 5.9 for sklearn in Python).

A detailed description of the data has also been listed in the above link.

Classifier:

Euclidean distance (L2 Norm) has been used to determine the distance. k = [1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99]. Data Set has been imported using sklearn.

On the original data set, the first 6,000 examples for training, and the last 1,000 examplesfor testing have been used. This can be altered by changing values of traning_examples , testing_examples

Plot curves for training and test errors:

The curve shows training/test error (which is equal to 1.0-accuracy) vs. the value of K. 11 points for the curve, using K = 1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99 have been ploted. The error curves for training error and test error have been ploted in the same figure. Result

Classification with Tensorflow:

Used sequential model with 2 layered neural network with each having 128 neurons on the same dataset. ImageClassification

knn-classifier's People

Contributors

tarunkolla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

vinhnv27

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.