# Introduction to Machine Learning with TensorFlow.js

DevFeed: [Introduction to Machine Learning with TensorFlow.js](<https://devfeed.tech/articles/hello-tensorflow-35524.md>)

Original publisher: [Read original article](<https://meowni.ca/posts/hello-tensorflow/>)

Author: Monica Dinculescu

Published: 2018-05-22T00:00:00Z

Content type: tutorial

Language: en

Sources: [Monica Dinculescu](<https://devfeed.tech/sources/monica-dinculescu.md>)

Topics: [Tensorflow](<https://devfeed.tech/topics/tensorflow.md>), [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Code](<https://devfeed.tech/topics/code.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [math](<https://devfeed.tech/topics/math.md>), [Demo](<https://devfeed.tech/topics/demo.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [code](<https://devfeed.tech/tags/code.md>), [demo](<https://devfeed.tech/tags/demo.md>), [graph](<https://devfeed.tech/tags/graph.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [math](<https://devfeed.tech/tags/math.md>), [models](<https://devfeed.tech/tags/models.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [tensorflow](<https://devfeed.tech/tags/tensorflow.md>)

## AI overview

This tutorial introduces machine learning concepts with TensorFlow.js, an open-source JavaScript library. It explains how models learn patterns from data and demonstrates fitting a curve by learning unknown coefficients from training points.

## Source excerpt

Machine Learning (ML) is the dope new thing that everyone's talking about, because it's really good at learning from data so that it can predict similar things in the future. Doing ML by hand is pretty annoying since it usually involves matrix math which is zero fun in JavaScript (or if you ask me: anywhere 😅). Thankfully, TensorFlow.js is here to help! It's an open source library that has a lot of built-in Machine Learning-y things like models and algorithms so that you don't have to write them from scratch. Is your problem a Machine Learning problem? Machine learning is good at classifying and labelling data. The premise of every machine learning problem is: Someone gives us some data that was generated according to a secret formula. This data could be a bunch of points (that are generated based on some math equation), but could also be fun, like images (the secret formula could be "some of these images are chihuahuas and some are blueberry muffins) or bus schedules. By looking at this data we were given, we approximate the secret formula so that we can correctly predict a future data point. For example, if we're given a photo, we will eventually be able to confidently say whether it's a dog or a muffin. A fun demo! If you want to get started, predicting numbers tends to be easier than predicting images, so in this example we're trying to fit a curve to a bunch of data (this is the same example from the TensorFlow site but with waaaaay more code comments and a prettier graph). We are given a bunch of points (for x between -1 and 1, calculate a y according to y = a * x^3 + b * x^2 + c * x + d - we know this is the secret formula but we don't know the values of those a,b,c,d coefficients.) Our goal is to learn these coefficients, so that if we're given a new x value, we can say what the y value should be. The blue dots are the training points we were given. The red dots would be our guesses, based on our initial, default coefficients (hella incorrect!). Once you cli