Building a simple regression model with TensorFlow.js
In the previous chapter, Chapter 9, Basics of Machine Learning, you were introduced to the basics of ML, especially the theoretical aspect of regression and classification models. In this section, we'll show you how to create and train a regression model using tfjs
LayerAPI. Specifically, by the end of this section, you'll have a regression model that can predict sales prices from supermarket data.
Setting up your environment locally
Before building the regression model, you have to set up your environment locally. In this section, we'll be working in a Node.js environment. This means that we'll be using the node
version of TensorFlow.js and Danfo.js.
Follow the steps here to set up your environment:
- In a new work directory, create a folder for your project. We will create one called
sales_predictor
, as demonstrated in the following code snippet:mkdir sales_predictor cd sales_predictor
- Next...