Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mudafar/alz-predictor
A JavaScript sequence prediction library, for building proactive and smart user interfaces.
https://github.com/mudafar/alz-predictor
activelezi adaptive ai algorithm client-side javascript-library lz77 prediction predictive-prefetching sequence spa ui
Last synced: about 7 hours ago
JSON representation
A JavaScript sequence prediction library, for building proactive and smart user interfaces.
- Host: GitHub
- URL: https://github.com/mudafar/alz-predictor
- Owner: mudafar
- License: mit
- Created: 2021-03-22T22:50:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-03T17:08:49.000Z (over 3 years ago)
- Last Synced: 2024-04-27T01:43:05.557Z (7 months ago)
- Topics: activelezi, adaptive, ai, algorithm, client-side, javascript-library, lz77, prediction, predictive-prefetching, sequence, spa, ui
- Language: JavaScript
- Homepage:
- Size: 173 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ALZ predictor · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/mudafar/alz-predictor/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/alz-predictor.svg?style=flat)](https://www.npmjs.com/package/alz-predictor) ![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)
ALZ predictor is a JavaScript library for symbols sequence prediction, based on **Gopalratnam and Cook Active LeZi algorithm**.
* **AI:** ALZ predictor makes it possible to create proactive and smart UIs. Improve your application UX by adding a touch of artificial intelligence. Guess and prefetch required data to enhance performance.
* **Simple:** Model each user action as a char, then train ALZ by simply adding them as they come (one by one). Predict next user action at any time.
* **Lightweight:** No dependencies.
## FAQ
- Why **JavaScript** and **Frontend AI** at all?
- No server-client latency
- Offline
- Privacy
- Cost
- [TensorFlow.js](https://www.tensorflow.org/js/) and [ONNX.JS](https://microsoft.github.io/onnxjs-demo/#/)- How to **save learning** data?
Serialize and save to browser **localStorage**.- What is the difference with **Guess.js**?
**Google Analytics** is **not** required for training.## Installation
```bash
# Yarn
yarn add alz-predictor# NPM
npm install --save alz-predictor
```## Usage
```js
import Predictor from 'alz-predictor'const predictor = new Predictor()
predictor.add('a')
predictor.add('b')
predictor.add('a')const predictions = predictor.predict()
```## Examples
- Next-page data predective prefetching:
- Online demo: https://mudafar.github.io/alz-predictor-prefetch-example/- [Source code](https://github.com/mudafar/alz-predictor-prefetch-example)
## Documentation
### Constructor
```js
const predictor = new Predictor()
```### Methods
- add: add `char` to the sequence.
- predict: get predictions object.
- loadJSON: recover state from JSON.### Serialization
```js
const predictor = new Predictor()
predictor.add('a')
predictor.add('b')const json = JSON.stringify(predictor)
```## License
ALZ predictor is [MIT licensed](./LICENSE).