FEDOT automates machine learning model development through its modeling framework.
m2cgen
m2cgen converts machine learning models into native code for multiple programming languages without runtime dependencies.

About m2cgen
m2cgen (Model 2 Code Generator) is a lightweight Python library that transpiles trained statistical models into native source code for a range of programming languages, including C, C#, Dart, F#, Go, Haskell, Java, JavaScript, PHP, PowerShell, Python, R, Ruby, Rust, Visual Basic and Elixir. The generated code is intended to have zero dependencies, so a trained model can be embedded where a full Python stack is not available. It can be used from Python or through a command-line interface, and requires Python 3.7 or newer.
Supported models come from scikit-learn, StatsModels, lightning, LightGBM and XGBoost, covering classification and regression across linear, SVM, tree, random forest and boosting families. Some model variants are only partially covered: for example, LGBM random-forest models are supported with the rf booster only, and XGBoost classifiers and regressors with the gbtree (including boosted forests) or gblinear boosters only. The project states that compatibility is guaranteed for the package versions tested in CI, and that other versions may work but are untested. Classification output follows the conventions of the underlying libraries, such as decision_function and predict_proba.
Key features
- Transpiles trained models into native code for Java, C, Python, Go, JavaScript, C#, R, Rust and others
- Supports scikit-learn, StatsModels, lightning, LightGBM and XGBoost models
- Covers classification and regression across linear, SVM, tree, forest and boosting families
- Classification output matches decision_function and predict_proba conventions
- Usable from a Python API or a command-line interface
- Provides a Docker setup for the pre-PR check command
- Open-source repository with a broad set of target programming languages
- Generated code is described as having zero dependencies
- Model compatibility listed across several popular ML libraries
- Requires Python 3.7 or newer
- Some model variants are limited to specific boosters, such as LGBM rf-only and XGBoost gbtree/gblinear
- Guaranteed compatibility applies only to package versions tested by CI; other versions are untested
m2cgen at a glance
- Type
- Open-source project
- Pricing
- Not confirmed. Check the site
- Open source
- Yes · Source code
- Language
- English
- Last checked
- Oct 6, 2026 · Online when checked
- Listed
- Oct 5, 2026
m2cgen alternatives
Tools and sites you could use instead, ranked by how closely they match.
Enables single machine or distributed training and evaluation of deep learning models.
Auto_ViML builds multiple machine learning models with a single line of code.
ParaMonte provides parallel Monte Carlo and machine learning tools across several programming languages.
Use Learnergy, a Python library for training and working with energy-based machine learning models.
Detecto supports building and training computer vision models with the PyTorch machine learning framework.
Popular in ML Training & Optimization
Well-known listings from the same topic.
m2cgen FAQ
Which Python versions does m2cgen support?
Can m2cgen be used without writing Python code?
Are all model variants of a library fully supported?
Tell us and an editor will check it.
Claim the listing and suggest updates yourself. An editor checks every claim first.












