# BayesWitnesses/m2cgen

Transform ML models into a native code (Java, C, Python, Go, JavaScript, Visual Basic, C#, R, PowerShell, PHP, Dart, Haskell, Ruby, F#, Rust) with zero dependencies

Repository: https://github.com/BayesWitnesses/m2cgen
Canonical: https://ross.abutalabs.com/products/m2cgen
Language: Python
License: MIT
License Family: permissive
Topics: machine-learning, scikit-learn, statistical-learning, xgboost, lightgbm, java, python, c, javascript, go, csharp, php, r, dartlang, statsmodels, lightning, haskell, ruby, rust
Last push: 2024-08-03T17:30:36+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 2790, "days_push": 760, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2998, forks 264 (observed 2026-08-28T04:07:37.244190+00:00)

## What it is
m2cgen is a lightweight Python library that transpiles trained statistical machine learning models into native code in languages such as Python, C, Java, Go, JavaScript, Rust, and more. It enables zero-dependency model inference by generating standalone scoring code from scikit-learn, XGBoost, LightGBM, StatsModels, and lightning models.

## Use cases
- deploy ML models in languages without Python runtimes
- generate dependency-free scoring code from a trained sklearn model
- transpile an XGBoost model to Java or C for embedded inference
- export a LightGBM classifier to Go or Rust source code
- run model inference in environments where installing ML libraries is impossible
- convert a trained regression model to JavaScript for browser-side prediction

## When to choose
- you need to serve a trained model in a language without ML library support
- you want zero-dependency, low-latency inference without shipping heavy ML runtimes
- you target embedded or constrained environments where only native code can run

## When to avoid
- you need to serve deep learning or neural network models
- you want a full model serving platform with APIs and monitoring
- your model uses estimators not in the supported list

## Facets
- artifact type: library
- maturity: maintenance
- function: machine-learning, compiler, developer-tools
- domain: machine-learning, developer-tools, programming-languages
- platform: python, cross-platform
- tags: transpilation, code-generation, scikit-learn, xgboost, lightgbm, zero-dependency-inference

## Member repositories
- BayesWitnesses/m2cgen (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:37.244190+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:30:36.226306+00:00, confidence not recorded.
  - readme: https://github.com/BayesWitnesses/m2cgen (fetched 2026-08-28T04:07:37.244190+00:00, sha e9e7e5eb1c5d)
  - registry_pypi: https://pypi.org/pypi/m2cgen/json (fetched 2026-08-29T09:45:50.891890+00:00, sha c67fb9dff22d)
- Data as of 2026-08-30T08:39:29.467469+00:00.
