{skjsn-js}

Zero dependencies. 100% mathematical accuracy (i think). Run your JSON models natively in any JS environment.

Installation

npm install skjson-js

Capabilities

Universal

Works in React, Vue, Vanilla JS, Node.js, and edge environments.

Type-Safe

Written in TypeScript, providing full autocomplete for `.predict()` and `.predict_proba()`.

Interactive Inference Demo

Try classifying an Iris flower (Random Forest model):
import { loadModel } from 'skjson-js';
import modelJson from './model.json';

const predictor = loadModel(modelJson);

// Running inference
const input = [[5.1, 3.5, 1.4, 0.2]];
const prediction = predictor.predict(input);

console.log("Predicted Class:", prediction[0]);

Preprocessing Execution (in progress)

If you exported a preprocessing model like `StandardScaler`, you can use the `.transform()` method natively:

const scaler = loadModel(scalerData)
const scaledFeatures = scaler.transform([[5.1, 3.5, 1.4, 0.2]])
console.log(scaledFeatures)

Roadmap

  • Load and infer common sklearn models

    Completed

  • Load and infer pipeline json

    Ongoing

  • Load and infer neural network json

    Idle