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.
-
Why JavaScript and Frontend AI at all?
- No server-client latency
- Offline
- Privacy
- Cost
- TensorFlow.js and ONNX.JS
-
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.
# Yarn
yarn add alz-predictor
# NPM
npm install --save alz-predictor
import Predictor from 'alz-predictor'
const predictor = new Predictor()
predictor.add('a')
predictor.add('b')
predictor.add('a')
const predictions = predictor.predict()
- Next-page data predective prefetching:
const predictor = new Predictor()
- add: add
char
to the sequence. - predict: get predictions object.
- loadJSON: recover state from JSON.
const predictor = new Predictor()
predictor.add('a')
predictor.add('b')
const json = JSON.stringify(predictor)
ALZ predictor is MIT licensed.