From 45c4305983c78f876457c35be602362a6935b6f8 Mon Sep 17 00:00:00 2001 From: Dan Crescimanno Date: Sat, 21 May 2022 12:20:13 -0700 Subject: [PATCH 1/3] updated docs --- README.md | 2 +- docs/docs/tutorial.md | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) 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/tutorial.md b/docs/docs/tutorial.md index 75ca34ab..d2517358 100644 --- a/docs/docs/tutorial.md +++ b/docs/docs/tutorial.md @@ -11,13 +11,13 @@ Let's discover **Scikit.js in less than 5 minutes**. Get started by **installing the library**. ```shell -npm install scikitjs +npm install scikitjs @tensorflow/tfjs ``` or ```shell -yarn add scikitjs +yarn add scikitjs @tensorflow/tfjs ``` ## Build a model @@ -25,7 +25,9 @@ yarn add scikitjs Build a simple Linear Regression ```js -import { LinearRegression } from 'scikitjs' +import * as tf from '@tensorflow/tfjs' +import { LinearRegression, setBackend } from 'scikitjs' +setBackend(tf) let X = [ [2, 3], From 81634833bb6063468e8668aba5483e0b0e02eef4 Mon Sep 17 00:00:00 2001 From: Dan Crescimanno Date: Sat, 21 May 2022 12:27:50 -0700 Subject: [PATCH 2/3] better tutorial docs --- docs/docs/tutorial.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/docs/tutorial.md b/docs/docs/tutorial.md index d2517358..8b1014b1 100644 --- a/docs/docs/tutorial.md +++ b/docs/docs/tutorial.md @@ -8,7 +8,7 @@ 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 @tensorflow/tfjs @@ -25,10 +25,12 @@ yarn add scikitjs @tensorflow/tfjs Build a simple Linear Regression ```js +// 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], From 63a2197f877be21399e0dee3206729ed424552d0 Mon Sep 17 00:00:00 2001 From: Dan Crescimanno Date: Sat, 21 May 2022 12:49:54 -0700 Subject: [PATCH 3/3] more updates --- docs/docs/python.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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]