Machine learning can be mathematically intensive. This is where JavaScript comes in handy, with its user-friendly software simplifying the process of creating and training neural networks.
Traditionally, Machine Learning applications have used R or Python .
But JavaScript has a great future as a Machine Learning language:
- JavaScript is very familiar. All developers can use it.
- Security is built-in. JavaScript cannot access your files.
- JavaScript is faster than Python.
- JavaScript can utilize hardware acceleration.
- JavaScript runs in the browser.
JavaScript is good for Machine Learning.
Machine learning can be mathematically heavy. The nature of neural networks is highly technical, and the jargon involved tends to intimidate people.
This is where JavaScript comes into play, with its user-friendly software simplifying the process of creating and training neural networks.
With the new Machine Learning libraries, JavaScript developers can add Machine Learning and Artificial Intelligence (AI) to web applications.
Machine Learning JavaScript Library
In browsers, Machine Learning means:
- Machine Learning in JavaScript
- Machine Learning for the Web
- Machine Learning for Everyone
- Machine Learning on More Platforms
Advantage:
- Easy to use. No installation required.
- Powerful graphics. Browser supports WebGL.
- Better security. Data can be stored on the client side.
- More platforms. JavaScript runs on mobile devices.
Brain.js
Brain.js is a JavaScript library that makes neural networks easier to understand because it hides the mathematical complexity.
Brain.js is very easy to use. You don't need to know the details of neural networks to work with Brain.js.
Brain.js offers many different neural network implementations because different neural networks can be trained to perform different tasks well.
ml5.js
ml5.js is trying to make Machine Learning more accessible to a wider audience.
The ml5 team is working to encapsulate Machine Learning functionality in more user-friendly ways.
The example below uses only 3 lines of code to classify an image:
Try replacing pic1.jpg with pic2.jpg, pic3.jpg, and pic4.jpg.
TensorFlow
TensorFlow Playground is a web application written in d3.js.
With TensorFlow Playground, you can learn about Neural Networks (NNs) without using mathematics.
You can create a neural network and see the results right in your web browser.
TensorFlow.js was formerly known as Tf.js and Deeplearn.js.
Math.js in the browser
Math.js is an extensible math library for JavaScript and Node.js.
Math.js is powerful and easy to use. It comes with a large set of built-in functions, a flexible expression parser, and solutions for working with many data types such as numbers, large numbers, complex numbers, fractions, units, arrays, and matrices.
Draw graphs in the browser.
Below is a list of some JavaScript libraries to use for both Machine Learning graphs and other HTML charts:
- HTML Canvas
- Plotly.js
- Chart.js
- Google Chart
- D3.js
Draw the graph.
Enter the equation: sin(x) * 2 + 17
Draw a graph.
Enter the values for X and Y:
50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150
7,8,8,9,9,9,10,11,14,14,15
WebGL API
WebGL is a JavaScript API for displaying 2D and 3D graphics in any browser.
WebGL can run on both integrated and discrete graphics cards in any computer.
WebGL brings 3D graphics to web browsers. Major browser vendors such as Apple (Safari), Google (Chrome), Microsoft (Edge), and Mozilla (Firefox) are all members of the WebGL Working Group.