quaintitative

I write about my quantitative explorations in visualisation, data science, machine and deep learning here, as well as other random musings.

For more about me and my other interests, visit playgrd or socials below


Categories
Subscribe

(Almost) All the Most Common Machine Learning Algorithms in Javascript

I did a Masters in Knowledge Engineering almost a decade ago. Back then, data science wasn’t a common term (if it was even used at all). Knowledge engineering was kind of the pre-cursor to data science today. The aim then was to use build systems that could facilitate knowledge management (the hot thing then). We learned things like rule based learning and neural networks.

My recollection of what I learnt then is pretty foggy.

But I do remember learning that the best way to understand how a model works is to build a simple implementation of it from scratch. With the wealth of libraries we have access to today, we sometimes forget this.

So I thought it would be good to just write down a whole suite of the most common machine learning methods from scratch in Javascript, let them run right on the client-side in the browser, and visualise their results in the browser using D3.js. I managed to cover -

The full code is available here. Each method is in its own .js file in the scripts folder.

A simulation of all these methods is available here. As the data used is generated randomly and a number of the methods are stochastic in nature, you should see different results each time you refresh the browser. You can also see all the different results being printed out in the browser console.


Articles

Comparing Prompts for Different Large Language Models (Other than ChatGPT)
AI and UIs
Listing NFTs
Extracting and Processing Wikidata datasets
Extracting and Processing Google Trends data
Extracting and Processing Reddit datasets from PushShift
Extracting and Processing GDELT GKG datasets from BigQuery
Some notes relating to Machine Learning
Some notes relating to Python
Using CCapture.js library with p5.js and three.js
Introduction to PoseNet with three.js
Topic Modelling
Three.js Series - Manipulating vertices in three.js
Three.js Series - Music and three.js
Three.js Series - Simple primer on three.js
HTML Scraping 101
(Almost) The Simplest Server Ever
Tweening in p5.js
Logistic Regression Classification in plain ole Javascript
Introduction to Machine Learning Right Inside the Browser
Nature and Math - Particle Swarm Optimisation
Growing a network garden in D3
Data Analytics with Blender
The Nature of Code Ported to Three.js
Primer on Generative Art in Blender
How normal are you? Checking distributional assumptions.
Monte Carlo Simulation of Value at Risk in Python
Measuring Expected Shortfall in Python
Style Transfer X Generative Art
Measuring Market Risk in Python
Simple charts | crossfilter.js and dc.js
d3.js vs. p5.js for visualisation
Portfolio Optimisation with Tensorflow and D3 Dashboard
Setting Up a Data Lab Environment - Part 6
Setting Up a Data Lab Environment - Part 5
Setting Up a Data Lab Environment - Part 4
Setting Up a Data Lab Environment - Part 3
Setting Up a Data Lab Environment - Part 2
Setting Up a Data Lab Environment - Part 1
Generating a Strange Attractor in three.js
(Almost) All the Most Common Machine Learning Algorithms in Javascript
3 Days of Hand Coding Visualisations - Day 3
3 Days of Hand Coding Visualisations - Day 2
3 Days of Hand Coding Visualisations - Day 1
3 Days of Hand Coding Visualisations - Introduction