Code Monkey home page Code Monkey logo

javascript-machine-learning's Introduction

Machine Learning Projects with JavaScript

6 projects to understand basic algorithms in Machine Learning, using Lodash and Tensorflow.js.

# Project Description
01 Plinko A quick introduction to K-Nearest Neighbors (KNN) algorithm using Lodash.
02 House Pricings Another implementation of K-Nearest Neighbors (KNN) algorithm with Tensorflow.js.
03 Gas Mileage Calculator A gradient descent algorithm in linear regression using Tensorflow.js.
04 Smog Test A gradient descent algorithm in logistic regression to handle natural binary classification.
05 Fuel Efficiency Class A multinominal logistic regression to handle multi-value classification.
06 Handwriting Recognition Another multinominal logistic regression with a larger dataset.

1) Plinko

A quick introduction to K-Nearest Neighbors (KNN) algorithm using Lodash.

See 01-plinko folder

Features

  • implementing K-Nearest Neighbors (KNN) algorithm with Lodash methods.
  • testing the algorithm and interpreting bad results.
  • creating random test and training datasets.
  • generalizing KNN, gauging accuracy and printing a report.
  • investigating optimal k values.
  • updating KNN for multiple features.
  • applying normalization with MinMax.
  • handling objective feature selection with KNN.

2) House Pricings

Another implementation of K-Nearest Neighbors (KNN) algorithm with Tensorflow.js.

See 02-house-pricings folder

Features

  • loading CSV data.
  • running K-Nearest Neighbors (KNN) algorithm with Tensorflow.js.
  • analyzing results and reporting error percentages.
  • applying standardization.
  • debugging calculations with node --inspect-brk and Chrome debugger.
  • adding features to get a better accuracy.

3) Gas Mileage Calculator

A gradient descent algorithm in linear regression using Tensorflow.js.

See 03-gas-mileage-calculator folder

Features

  • loading CSV data and creating a LinearRegression class.
  • creating a basic gradient descent implementation with arrays of data and for loops.
  • calculating mean squared error (MSE) slopes, updating coefficients and interpreting results.
  • understanding matrix multiplication.
  • vectorizing the gradient descent algorithm with Tensorflow.js helpers.
  • gauging model accuracy by implementing the coefficient of determination.
  • applying standardization and massaging learning rates.
  • refactoring for multivariate regression.
  • tracking MSE history to update learning rate automatically.
  • plotting MSE history with nodeplotlib.
  • refactoring towards batch and stochastic gradient descent for better performances.
  • making predictions with the model.

4) Smog Test

A gradient descent algorithm in logistic regression to handle natural binary classification.

See 04-smog-test folder

Features

  • updating linear regression for logistic regression by adding the sigmoid equation.
  • implementing a test function to gauge classification accuracy.
  • supporting variable decision boundaries.
  • refactoring with cross entropy to update learning rate.
  • plotting cost history with nodeplotlib.

5) Fuel Efficiency Class

A multinominal logistic regression to handle multi-value classification.

See 05-fuel-efficiency folder

Features

  • refactoring to multi-column weights.
  • classifying continuous values in 3 ranges of fuel consumption: low, medium and high.
  • training a multinominal model.
  • handling conditional probability distribution with the softmax equation.
  • implementing accuracy gauges with argMax() and calculating accurary.

6) Handwriting Recognition

Another multinominal logistic regression with a larger dataset.

See 06-handwriting-recognition folder

Features

  • flattening image data from MNIST handwritten digit database.
  • encoding label values and implementing an accuracy gauge.
  • debugging the calculation process with node --inspect-brk.
  • dealing with zero variances.
  • creating memory snapshots with Chrome debugger.
  • releasing references to MNIST dataset.
  • optimizing Tensorflow.js memory usage with tf.tidy().
  • measuring footprint reduction.
  • plotting cost history and improving model accuracy.

Based on Machine Learning with JavaScript by Stephen Grider (2021).

javascript-machine-learning's People

Contributors

solygambas avatar

Watchers

 avatar  avatar  avatar

Forkers

himanshuraj677

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.