diff --git a/README.md b/README.md index fe35a3f..d755753 100644 --- a/README.md +++ b/README.md @@ -21,15 +21,17 @@ Documentation site: [www.scikitjs.org](https://www.scikitjs.org) For use with modern bundlers in a frontend application, simply ```bash +npm i @tensorflow/tfjs npm i scikitjs ``` -Usage is similar to other js libraries. We depend on the tensorflow library in order to make our calculations fast, but we don't ship it in our bundle. We use it as a peer dependency. General usage is as follows. +We depend on the tensorflow library in order to make our calculations fast, but we don't ship it in our bundle. +We use it as a peer dependency. General usage is as follows. ```js import * as tf from '@tensorflow/tfjs' -import { LinearRegression, setBackend } from 'scikitjs' -setBackend(tf) +import * as sk from 'scikitjs' +sk.setBackend(tf) ``` This allows us to build a library that can be used in Deno, Node, and the browser with the same configuration. @@ -38,15 +40,14 @@ This allows us to build a library that can be used in Deno, Node, and the browse For Node.js users who wish to bind to the Tensorflow C++ library, simply import the tensorflow C++ version, and use that as the tf library ```bash +npm i @tensorflow/tfjs-node npm i scikitjs ``` -But then import the node bindings - ```js import * as tf from '@tensorflow/tfjs-node' -import { LinearRegression, setBackend } from 'scikitjs' -setBackend(tf) +import * as sk from 'scikitjs' +sk.setBackend(tf) ``` ### Script src @@ -57,8 +58,10 @@ For those that wish to use script src tags, simply ``` @@ -66,7 +69,7 @@ For those that wish to use script src tags, simply ```js import * as tf from '@tensorflow/tfjs-node' -import { LinearRegression, setBackend } from 'scikitjs' +import { setBackend, LinearRegression } from 'scikitjs' setBackend(tf) const lr = new LinearRegression({ fitIntercept: false }) @@ -126,7 +129,7 @@ Turns into ```js import * as tf from '@tensorflow/tfjs-node' -import { LinearRegression, setBackend } from 'scikitjs' +import { setBackend, LinearRegression } from 'scikitjs' setBackend(tf) let X = [[1], [2]] @@ -158,7 +161,7 @@ Turns into ```js import * as tf from '@tensorflow/tfjs-node' -import { LinearRegression, setBackend } from 'scikitjs' +import { setBackend, LinearRegression } from 'scikitjs' setBackend(tf) let X = [[1], [2]] @@ -195,7 +198,7 @@ Turns into ```js import * as tf from '@tensorflow/tfjs-node' -import { LogisticRegression, setBackend } from 'scikitjs' +import { setBackend, LogisticRegression } from 'scikitjs' setBackend(tf) let X = [[1], [-1]]