Skip to main content

Export scikit-learn models to JSON for cross-language inference

Project description

skjson

Export scikit-learn models to JSON for cross-language inference.

Installation

pip install skjson

Quick Start

import skjson
from sklearn.linear_model import LinearRegression
import numpy as np

# Train
model = LinearRegression().fit(np.array([[1], [2], [3]]), np.array([1, 2, 3]))

# Export
skjson.save(model, "model.json", feature_names=["x"])

# Load & predict (no sklearn needed)
predictor = skjson.load("model.json")
predictions = predictor.predict([[4], [5]])

Future Directions

  • Support for scikit-learn Pipeline objects and feature unions.
  • npm package for inference using our json models
  • Support for sklearn.neural_network models

Note

  • This project built with Google Gemini and Claude Opus.
  • If you wish to contribute, please contact me.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skjson-0.1.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skjson-0.1.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file skjson-0.1.0.tar.gz.

File metadata

  • Download URL: skjson-0.1.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for skjson-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2b959d40700e47d68bc6ef92f7fdad09bd0889b8daa0543a5d799c180497cac3
MD5 8b8a4adf27087a82b119762b79dc4843
BLAKE2b-256 b04a400210b69ced4c8d15c49aa5619d43528e3f2debd82fb572fe5a57b7ef08

See more details on using hashes here.

Provenance

The following attestation bundles were made for skjson-0.1.0.tar.gz:

Publisher: publish.yml on hongyaok/skjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file skjson-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: skjson-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for skjson-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5499b4f174189ee1c5bfc550b69fa21eb8022705a4e589ec5b090759dfa08c6
MD5 692f1db78b211f1076fe2b097b126a24
BLAKE2b-256 88da9ab47c2d6033fc88ec692a4302231839a3db4df85d1ab21c6489c335a807

See more details on using hashes here.

Provenance

The following attestation bundles were made for skjson-0.1.0-py3-none-any.whl:

Publisher: publish.yml on hongyaok/skjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page