项目作者: imgcook

项目描述 :
Feature Engineering in JavaScript.
高级语言: TypeScript
项目地址: git://github.com/imgcook/datacook.git
创建时间: 2020-10-26T11:50:24Z
项目社区:https://github.com/imgcook/datacook

开源协议:Apache License 2.0

下载


DataCook

Machine learning and data science library for Javascript / Typescript.


Getting started

Dependencies

DataCook is built for javascript environment and can run in both node.js platform and browser. DataCook relies on tensorflow.js for basic numeric computation.

Quick installation

DataCook can be installed by npm:

  1. npm install @pipcook/datacook

or by yarn

  1. yarn add @pipcook/datacook

Quick start: Train a simple linear-regression model

  1. import { Model } from '@pipcook/datacook';
  2. const { LinearRegression } = Model;
  3. const X = [
  4. [4, 5],
  5. [2, 3],
  6. [1, 4],
  7. [3, 8],
  8. ];
  9. const y = [10, 5.5, 6.5, 12];
  10. // create model
  11. const lm = new LinearRegression();
  12. // train linear model using feature set X and label set y
  13. await lm.fit(X, y);
  14. // get prediction
  15. const yPred = lm.predict(X);
  16. yPred.print();
  17. // [10, 6, 6, 12]