← all repositories
nok/sklearn-porter

Take your scikit-learn model to C, Java, or JS — no runtime required

A transpiler that turns trained estimators into standalone code for embedded systems and performance-critical deployments.

sklearn-porter
Not currently ranked — collecting fresh signals.
star history

What it does

sklearn-porter converts trained scikit-learn estimators into source code in C, Java, JavaScript, Go, PHP, or Ruby. The output runs without Python or scikit-learn installed — useful when you need to drop a decision tree onto a microcontroller or ship an SVM inside a mobile app.

The interesting bit

The project doesn’t just dump coefficients; it generates actual executable logic (if-else chains for trees, kernel computations for SVMs) and offers three template modes: attached data, exported JSON, or combined. It even includes an integrity-check test() that verifies the ported version matches Python’s output.

Key highlights

  • Supports 10 estimator families including SVMs, random forests, neural nets, and naive Bayes
  • Coverage varies sharply by language: decision trees work everywhere; MLPRegressor only emits JavaScript
  • CLI, functional, and OOP APIs all available
  • Development branch targets v1.0.0; stable release is v0.7.4
  • Requires scikit-learn between 0.17 and 0.22 — notably behind current releases

Caveats

  • Scikit-learn version ceiling of 0.22 means many modern projects won’t be compatible
  • Support matrix has significant gaps: no C or Go for random forests, no Java for AdaBoost, etc.
  • README warns to “always” run the integrity check, suggesting edge cases exist

Verdict

Worth a look if you’re maintaining legacy scikit-learn pipelines and need to deploy to constrained environments. Skip it if you’re on modern scikit-learn or need broad language coverage for newer estimators.

Frequently asked

What is nok/sklearn-porter?
A transpiler that turns trained estimators into standalone code for embedded systems and performance-critical deployments.
Is sklearn-porter open source?
Yes — nok/sklearn-porter is open source, released under the BSD-3-Clause license.
What language is sklearn-porter written in?
nok/sklearn-porter is primarily written in Python.
How popular is sklearn-porter?
nok/sklearn-porter has 1.3k stars on GitHub.
Where can I find sklearn-porter?
nok/sklearn-porter is on GitHub at https://github.com/nok/sklearn-porter.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.