diff --git a/README.md b/README.md index 07fd6a6d..564093d7 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ const sk = require('scikitjs') sk.setBackend(tf) ``` -Note: If you have ESM enabled (by setting type="module" in your package.json), then you can consume this libary with import / export, like in the following code block. +Note: If you have ESM enabled (by setting type="module" in your package.json), then you can consume this library with import / export, like in the following code block. ```js import * as tf from '@tensorflow/tfjs-node' diff --git a/docs/docs/python.md b/docs/docs/python.md index deb4ee06..081808c3 100644 --- a/docs/docs/python.md +++ b/docs/docs/python.md @@ -47,7 +47,9 @@ Turns into #### javascript ```js -import { LinearRegression } from 'scikitjs' +import * as tf from '@tensorflow/tfjs' +import { LinearRegression, setBackend } from 'scikitjs' +setBackend(tf) let X = [[1], [2]] let y = [10, 20] @@ -77,7 +79,9 @@ Turns into #### javascript ```js -import { LinearRegression } from 'scikitjs' +import * as tf from '@tensorflow/tfjs' +import { LinearRegression, setBackend } from 'scikitjs' +setBackend(tf) let X = [[1], [2]] let y = [10, 20] @@ -112,7 +116,9 @@ Turns into #### javascript ```js -import { LogisticRegression } from 'scikitjs' +import * as tf from '@tensorflow/tfjs' +import { LogisticRegression, setBackend } from 'scikitjs' +setBackend(tf) let X = [[1], [-1]] let y = [1, 0] diff --git a/docs/docs/tutorial.md b/docs/docs/tutorial.md index 75ca34ab..8b1014b1 100644 --- a/docs/docs/tutorial.md +++ b/docs/docs/tutorial.md @@ -8,16 +8,16 @@ Let's discover **Scikit.js in less than 5 minutes**. ## Getting Started -Get started by **installing the library**. +Get started by **installing the library as well as it's dependencies**. ```shell -npm install scikitjs +npm install scikitjs @tensorflow/tfjs ``` or ```shell -yarn add scikitjs +yarn add scikitjs @tensorflow/tfjs ``` ## Build a model @@ -25,8 +25,12 @@ yarn add scikitjs Build a simple Linear Regression ```js -import { LinearRegression } from 'scikitjs' +// import tensorflow and register it as the backend +import * as tf from '@tensorflow/tfjs' +import { LinearRegression, setBackend } from 'scikitjs' +setBackend(tf) +// Perform a linear regression let X = [ [2, 3], [1, 4],