# scikit-learn

> Node.js wrapper of scikit-learn

Latest version **0.1.0** (published 2014-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install scikit-learn
pnpm add scikit-learn
yarn add scikit-learn
bun add scikit-learn
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-03-14 |
| First published | 2014-03-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.21 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Konstantin Burykin |
| Maintainers | burkostya |
| Keywords | scikit-learn, scikit, ml, machine learning, python |

## Links

- npm: https://www.npmjs.com/package/scikit-learn
- Repository: https://github.com:burkostya/scikit-zero
- Homepage: http://github.com/burkostya/scikit-zero
- Issues: http://github.com/burkostya/scikit-zero/issues
- npm.io page: https://npm.io/package/scikit-learn

## Dependencies (2)

- [JSONStream](https://npm.io/package/JSONStream.md) ^0.8.0
- [streaming-json-stringify](https://npm.io/package/streaming-json-stringify.md) ^1.0.0

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2014-03-14

## README

# scikit-learn

Node.js wrapper of scikit-learn

## Installation

`npm install scikit-learn`

## Usage

`var scikit = require('scikit-learn')`

## Example

```js
var inspect = require('inspect-stream');

var arrayify = require('arrayify-merge.s');
var slice    = require('slice-flow.s');

var scikit = require('scikit-learn');

var features = scikit.dataset('load_digits.data'); //stream of features
var labels   = scikit.dataset('load_digits.target'); //stream of labels

// arrayify is transform stream that turns two input streams
// into one stream by wraping packets of inputs in array.
// So trainingSet outputs arrays [<feature>, <label>]
var trainingSet = arrayify();
features.pipe(trainingSet);
labels.pipe(trainingSet);

var clf = scikit.svm('SVC', {
  gamma: 0.001,
  C:     100
});

trainingSet
  .pipe(slice([0, -1])) //passes all packets except last one
  .pipe(clf)
  .on('error', function (err) {
    console.log(err);
  })
  .on('end', function () {
    // now we have trained model

    var predict = clf.predict();
    var features = scikit.dataset('load_digits.data');
    features.pipe(slice(-1)) //passes only last packet
      .pipe(predict)
      .pipe(inspect());
  });
```

## API

### scikit.dataset(name, options)

* name `String` Name of method of `sklearn.datasets` on python side
                concatenated by dot with name of dataset's subset
                Ex: 'load_digits.target'
* options `Object` Options of method

Returns readable stream of dataset

### Fit streams

All fit streams are transform streams that acts like writable.
So you must listen on `end` event instead of `finish`
to be sure that training finished

Accepts flow of arrays like [features, label]
where 'features' is array of features and label is... label

Also fit stream have event 'model' that emits with trained model.
Model is `Buffer` containing pickled object

Fit stream have method `predict` that returns Predict stream

#### scikit.svm(name, options)

* name `String` Name of method of `sklearn.svm` 
* options `Object` Options for estimator

### Predict streams

Predict stream is transform stream that accepts flow of arrays of features
and outputs predictions

---
_Source: https://npm.io/package/scikit-learn · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
