Example 1 – linear regression
Before we dive into the first example, let's take a minute to set up our project folder and dependencies. Create a new folder called Ch7-Regression
, and inside that folder add the following package.json
file:
{ "name": "Ch7-Regression", "version": "1.0.0", "description": "ML in JS Example for Chapter 7 - Regression", "main": "src/index.js", "author": "Burak Kanber", "license": "MIT", "scripts": { "build-web": "browserify src/index.js -o dist/index.js -t [ babelify --presets [ env ] ]", "build-cli": "browserify src/index.js --node -o dist/index.js -t [ babelify --presets [ env ] ]", "start": "yarn build-cli && node dist/index.js" }, "dependencies": { "babel-core": "^6.26.0", "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-preset-env": "^1.6.1", "babelify": "^8.0.0", "browserify": "^15.1.0", "dspjs": "^1.0.0", "regression": "^2.0.1" } }
Then run the yarn install
command from the command line to install all dependencies. Next, create a folder...