# mlt-ts

> Typescript port of the BYU CS 478 machine learning toolkit

Latest version **0.0.5** (published 2017-09-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install mlt-ts
pnpm add mlt-ts
yarn add mlt-ts
bun add mlt-ts
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2017-09-19 |
| First published | 2017-09-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dan Steren |
| Maintainers | dansteren |
| Keywords | machine learning, typescript, byu |

## Links

- npm: https://www.npmjs.com/package/mlt-ts
- Repository: https://github.com/dansteren/mlt-ts
- Homepage: https://github.com/dansteren/mlt-ts#readme
- Issues: https://github.com/dansteren/mlt-ts/issues
- npm.io page: https://npm.io/package/mlt-ts

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.5 (latest) — 2017-09-19
- 0.0.4 — 2017-09-19
- 0.0.3 — 2017-09-17
- 0.0.2 — 2017-09-17
- 0.0.1 — 2017-09-17

## README

# mlt-ts

Typescript port of the BYU CS 478 [machine learning toolkit](http://axon.cs.byu.edu/~martinez/classes/478/stuff/Toolkit.html)

## Getting Started

1. Install mlt-ts

```bash
npm install mlt-ts
```
2. Download some datasets
```bash
mkdir datasets
wget http://axon.cs.byu.edu/~martinez/classes/478/stuff/iris.arff -P datasets/
```
3. Write a program to take in parameters and call the toolkit. This can be as simple as:
```typescript
import { SupervisedLearner, BaselineLearner, run } from './malt';

function getLearner(model: string): SupervisedLearner {
  switch (model) {
    case 'baseline':
      return new BaselineLearner();
    case 'perceptron':
    // return new Perceptron();
    case 'neuralnet':
    // return new NeuralNet();
    case 'decisiontree':
    // return new DecisionTree();
    case 'knn':
    // return new InstanceBasedLearner();
    default:
      throw new Error('Unrecognized model: ' + model);
  }
}

//Parse the command line arguments
const learnerName = process.argv[3];

run(getLearner(learnerName));
```

4. Compile your typscript program and run
```bash
node compiledProgram.js -L baseline -A datasets/iris.arff -E training
```

## Creating Learners

Creating new learners is as simple as extending the SupervisedLearner class provided by the toolkit. Just make sure to override the `train()` and `predict()` functions of the `SupervisedLearner` base class.

```typescript
import { Matrix, SupervisedLearner } from 'mlt-ts';

class MyNewLearner extends SupervisedLearner {

  train(features: Matrix, labels: Matrix) {
    // Your training algorithm here.
  }

	predict(features: number[], labels: number[]) {
    // Your prediction algorithm here.
  }
}
```

## Contributing

There are bound to be bugs in this project. Please help fix them by creating PRs.

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