GithubHelp home page GithubHelp logo

knn-classification's Introduction

About the problem

I have implemented a nearest neighbor algorithm from scratch to classify glass types of different glass . I have also extended the implementation as weighted KNN as well.

Dataset consists of 214 samples with discrete 6 class types. (Type 4 class have no samples in the dataset, thus the dataset includes 6 different class types {”1”, ”2”, ”3”, ”5”, ”6”, ”7”}

Attribute Information:

  1. RI: refractive index
  2. Na: Sodium
  3. Mg: Magnesium
  4. Al: Aluminum
  5. Si: Silicon
  6. K: Potassium
  7. Ca: Calcium
  8. Ba: Barium
  9. Fe: Iron
  10. Type: Type of glass: (class attribute)

Learning about:

  1. Feature Normalization
  2. Shuffle all data using numpy permutations
  3. Cross validation for dataset
  4. Implemented a nearest neighbor algorithm
  5. Implemented weighted nearest neighbor algorithm

Observations and result analysis

  1. Selecting K as 1 or 3, is the most convientient for this tasks.
  2. weighted_normalized data give in avarage the 67% as accuracy
  3. The more datat we have, the more the accuracy improved.
  4. When we have less Data, crross valiation is important.
  5. Without shuffling data, accuracy goes down. KNN does not generalize well.
  6. Learning happended, we we shuffle data and diverse the features.
  7. Accuracy may be improved by adding more data.
  8. Cross validation increased time of training better to now use 5 K. 3 maybe good. because I does not increaze overall accuracy that much.
  9. "Weighted non-normalized KNN"is the right implmentation for glass classification.
  10. Weighted Normalized KNN is not a good choice for this problem.
  11. Normalization data does not help much when the distance are too close

knn-classification's People

Contributors

momenai avatar

Stargazers

Abood avatar Mervegül Kantarcı avatar

Watchers

 avatar

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.