Giter VIP home page Giter VIP logo

knn-abalone_scratch's Introduction

KNN using Abalone Dataset

Learning Objectives:

  • To familiarize with the implementation of a machine learning algorithm from scratch, without the usage of any machine learning API.
  • To apply KNN algorithm to classify the age of abalone using the Abalone dataset.
  • To familiarize with evaluating the performance of a machine learning algorithm

Dataset

There are 4,177 data observations in the dataset with 8 input attributes and 1 output variable. The input attributes are as follows:

  1. Sex [Male (M), Female (F), or Infant (I)]
  2. Length
  3. Diameter
  4. Height
  5. Whole weight
  6. Shucked weight
  7. Viscera weight
  8. Shell weight
  9. Rings (output)

Tasks

  1. Use the function loadData() to load data from file. The command X = loadData(‘abalone.data’) returns an array of size . In this function, the values of the first attribute have been converted into floats:
  • M: 0.333
  • F: 0.666
  • I: 1.000
  1. Normalize the dataset. You are to normalize the 8 input attributes by writing a function, dataNorm(). The normalization equation is given as: (data-min)/(maxmin)

  2. Split the dataset into training and testing set by: (i) Using the train-and-test split method. (ii) Using the -fold cross-validation method. Note that the k -value here is different from the K-value in the KNN algorithm. Set the k value to 5, 10 and 15 respectively.

  3. Implement the KNN algorithm by writing a function, KNN() . You can use the Euclidean distance as the similarity measure for any two samples.

  4. Use the classification_report() function provided by the scikit-learn library to construct aclassification report for the 5-fold cross validation with K = 15

knn-abalone_scratch's People

Contributors

iameleannn 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.