# stitch-ml

> An experimental machine learning library written in Javascript.

Latest version **0.2.0** (published 2023-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install stitch-ml
pnpm add stitch-ml
yarn add stitch-ml
bun add stitch-ml
```

## 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.2.0 |
| Published | 2023-01-28 |
| First published | 2023-01-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=14.15.0 |
| Dependencies | 3 |
| Unpacked size | 28.5 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| Author | Chandler Freeman |
| Maintainers | thespychief |
| Keywords | stitch, pure javascript, neural network, machine learning, library |

## Links

- npm: https://www.npmjs.com/package/stitch-ml
- npm.io page: https://npm.io/package/stitch-ml

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) 4.17.21
- [threads](https://npm.io/package/threads.md) 1.7.0
- [cli-progress](https://npm.io/package/cli-progress.md) 3.11.2

## Recent versions

- 0.2.0 (latest) — 2023-01-28
- 0.1.0 — 2023-01-26

## README

Stitch ML
========

> **This package is still in Alpha.** All future versions are subject to
breaking changes until the official first version, at which point the full
documentation will be released and Semantic Versioning will be used.

Stitch ML is an experimental machine learning library written in pure
Javascript.

## Overview

### Installation

```cmd
npm install stitch-ml --save
```

## Usage

With CommonJS:
```js
const StitchML = require('stitch-ml');
```

With ES Modules:
```js
import StitchML from 'stitch-ml';
```

### Input Data Format
```javascript
0 <= x <= 1

[
  {
    "input": [x, x, x, x, x, x, ...],
    "output": [x, x, x, x, ...]
  },
  ...
]
```

### Examples

```javascript
// Create a new network
const network = new StitchML.Network({
  structure: [784, 100, 10],
});

// Train the network for one epoch
network.train({ data: trainingData });

// Predict a single point
network.predict(input);

// Save the network
const modelToSave = network.save();
fs.writeFileSync('model.json', JSON.stringify(modelToSave));

// Load a network
const modelToLoad = JSON.parse(fs.readFileSync('model.json'));
const networkFromModel = new Stitch.Network(modelToLoad);
```

### Performance

##### MNIST

```
Dataset: MNIST Handwritten Digits
Device: 2014 Macbook Pro, 2.5 GHz Quad-Core Intel Core i7
Training Set Size: 60000, One Epoch
Test Set Size: 10000
---------------------------------------------------------
Training Time: 2:57.259 (m:ss.mmm)
Prediction Time: 0.789 ms
Accuracy: 9441 / 10000
```

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