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

Overview

m2cgen

GitHub Actions Status Coverage Status License: MIT Python Versions PyPI Version Downloads

m2cgen (Model 2 Code Generator) - is a lightweight library which provides an easy way to transpile trained statistical models into a native code (Python, C, Java, Go, JavaScript, Visual Basic, C#, PowerShell, R, PHP, Dart, Haskell, Ruby, F#, Rust).

Installation

Supported Python version is >= 3.6.

pip install m2cgen

Supported Languages

  • C
  • C#
  • Dart
  • F#
  • Go
  • Haskell
  • Java
  • JavaScript
  • PHP
  • PowerShell
  • Python
  • R
  • Ruby
  • Rust
  • Visual Basic (VBA-compatible)

Supported Models

Classification Regression
Linear
  • scikit-learn
    • LogisticRegression
    • LogisticRegressionCV
    • PassiveAggressiveClassifier
    • Perceptron
    • RidgeClassifier
    • RidgeClassifierCV
    • SGDClassifier
  • lightning
    • AdaGradClassifier
    • CDClassifier
    • FistaClassifier
    • SAGAClassifier
    • SAGClassifier
    • SDCAClassifier
    • SGDClassifier
  • scikit-learn
    • ARDRegression
    • BayesianRidge
    • ElasticNet
    • ElasticNetCV
    • GammaRegressor
    • HuberRegressor
    • Lars
    • LarsCV
    • Lasso
    • LassoCV
    • LassoLars
    • LassoLarsCV
    • LassoLarsIC
    • LinearRegression
    • OrthogonalMatchingPursuit
    • OrthogonalMatchingPursuitCV
    • PassiveAggressiveRegressor
    • PoissonRegressor
    • RANSACRegressor(only supported regression estimators can be used as a base estimator)
    • Ridge
    • RidgeCV
    • SGDRegressor
    • TheilSenRegressor
    • TweedieRegressor
  • StatsModels
    • Generalized Least Squares (GLS)
    • Generalized Least Squares with AR Errors (GLSAR)
    • Generalized Linear Models (GLM)
    • Ordinary Least Squares (OLS)
    • [Gaussian] Process Regression Using Maximum Likelihood-based Estimation (ProcessMLE)
    • Quantile Regression (QuantReg)
    • Weighted Least Squares (WLS)
  • lightning
    • AdaGradRegressor
    • CDRegressor
    • FistaRegressor
    • SAGARegressor
    • SAGRegressor
    • SDCARegressor
    • SGDRegressor
SVM
  • scikit-learn
    • LinearSVC
    • NuSVC
    • OneClassSVM
    • SVC
  • lightning
    • KernelSVC
    • LinearSVC
  • scikit-learn
    • LinearSVR
    • NuSVR
    • SVR
  • lightning
    • LinearSVR
Tree
  • DecisionTreeClassifier
  • ExtraTreeClassifier
  • DecisionTreeRegressor
  • ExtraTreeRegressor
Random Forest
  • ExtraTreesClassifier
  • LGBMClassifier(rf booster only)
  • RandomForestClassifier
  • XGBRFClassifier
  • ExtraTreesRegressor
  • LGBMRegressor(rf booster only)
  • RandomForestRegressor
  • XGBRFRegressor
Boosting
  • LGBMClassifier(gbdt/dart/goss booster only)
  • XGBClassifier(gbtree(including boosted forests)/gblinear booster only)
    • LGBMRegressor(gbdt/dart/goss booster only)
    • XGBRegressor(gbtree(including boosted forests)/gblinear booster only)

    You can find versions of packages with which compatibility is guaranteed by CI tests here. Other versions can also be supported but they are untested.

    Classification Output

    Linear / Linear SVM / Kernel SVM

    Binary

    Scalar value; signed distance of the sample to the hyperplane for the second class.

    Multiclass

    Vector value; signed distance of the sample to the hyperplane per each class.

    Comment

    The output is consistent with the output of LinearClassifierMixin.decision_function.

    SVM

    Outlier detection

    Scalar value; signed distance of the sample to the separating hyperplane: positive for an inlier and negative for an outlier.

    Binary

    Scalar value; signed distance of the sample to the hyperplane for the second class.

    Multiclass

    Vector value; one-vs-one score for each class, shape (n_samples, n_classes * (n_classes-1) / 2).

    Comment

    The output is consistent with the output of BaseSVC.decision_function when the decision_function_shape is set to ovo.

    Tree / Random Forest / Boosting

    Binary

    Vector value; class probabilities.

    Multiclass

    Vector value; class probabilities.

    Comment

    The output is consistent with the output of the predict_proba method of DecisionTreeClassifier / ExtraTreeClassifier / ExtraTreesClassifier / RandomForestClassifier / XGBRFClassifier / XGBClassifier / LGBMClassifier.

    Usage

    Here's a simple example of how a linear model trained in Python environment can be represented in Java code:

    from sklearn.datasets import load_boston
    from sklearn import linear_model
    import m2cgen as m2c
    
    boston = load_boston()
    X, y = boston.data, boston.target
    
    estimator = linear_model.LinearRegression()
    estimator.fit(X, y)
    
    code = m2c.export_to_java(estimator)

    Generated Java code:

    public class Model {
    
        public static double score(double[] input) {
            return (((((((((((((36.45948838508965) + ((input[0]) * (-0.10801135783679647))) + ((input[1]) * (0.04642045836688297))) + ((input[2]) * (0.020558626367073608))) + ((input[3]) * (2.6867338193449406))) + ((input[4]) * (-17.76661122830004))) + ((input[5]) * (3.8098652068092163))) + ((input[6]) * (0.0006922246403454562))) + ((input[7]) * (-1.475566845600257))) + ((input[8]) * (0.30604947898516943))) + ((input[9]) * (-0.012334593916574394))) + ((input[10]) * (-0.9527472317072884))) + ((input[11]) * (0.009311683273794044))) + ((input[12]) * (-0.5247583778554867));
        }
    }

    You can find more examples of generated code for different models/languages here.

    CLI

    m2cgen can be used as a CLI tool to generate code using serialized model objects (pickle protocol):

    $ m2cgen 
       
         --language 
        
          [--indent 
         
          ] [--function_name 
          
           ]
             [--class_name 
           
            ] [--module_name 
            
             ] [--package_name 
             
              ] [--namespace 
              
               ] [--recursion-limit 
               
                ] 
               
              
             
            
           
          
         
        
       

    Don't forget that for unpickling serialized model objects their classes must be defined in the top level of an importable module in the unpickling environment.

    Piping is also supported:

    $ cat 
       
         | m2cgen --language 
        
    
        
       

    FAQ

    Q: Generation fails with RecursionError: maximum recursion depth exceeded error.

    A: If this error occurs while generating code using an ensemble model, try to reduce the number of trained estimators within that model. Alternatively you can increase the maximum recursion depth with sys.setrecursionlimit( ) .

    Q: Generation fails with ImportError: No module named error while transpiling model from a serialized model object.

    A: This error indicates that pickle protocol cannot deserialize model object. For unpickling serialized model objects, it is required that their classes must be defined in the top level of an importable module in the unpickling environment. So installation of package which provided model's class definition should solve the problem.

    Q: Generated by m2cgen code provides different results for some inputs compared to original Python model from which the code were obtained.

    A: Some models force input data to be particular type during prediction phase in their native Python libraries. Currently, m2cgen works only with float64 (double) data type. You can try to cast your input data to another type manually and check results again. Also, some small differences can happen due to specific implementation of floating-point arithmetic in a target language.

    Issues
    • Code generated for XGBoost models returns invalid scores when tree_method is set to

      Code generated for XGBoost models returns invalid scores when tree_method is set to "hist"

      I have trained xgboost models in Python and am using the CLI interface to convert the serialized models to pure python. However, when I use the pure python, the results differ from the predictions using the model directly.

      Python 3.7 xgboost 0.90

      My model has a large number of parameters (somewhat over 500). Here are predicted class probabilities from the original model: image

      Here are the same predicted probabilities using the generated python code via m2cgen: image

      We can see that the results are similar but not the same. The result is a significant number of cases that are moved into different classes between the two sets of predictions.

      I have also tested this with binary classification models and have the same issues.

      opened by eafpres 19
    • added support for R

      added support for R

      R is among of the most popular languages for data analysis.

      opened by StrikerRUS 16
    • Limit the number of leaves in each subroutine for gradient boosted trees

      Limit the number of leaves in each subroutine for gradient boosted trees

      Fixes https://github.com/BayesWitnesses/m2cgen/issues/103

      opened by chris-smith-zocdoc 15
    • In Java interpreter ignore subroutines and perform code split based on the AST size

      In Java interpreter ignore subroutines and perform code split based on the AST size

      After investigating possible solutions for https://github.com/BayesWitnesses/m2cgen/issues/152, I came to a conclusion that with the existing design it's extremely hard to come up with the optimal algorithm to split code into subroutines on the interpreter side (and not in assemblers). The primary reason for that is that since we always interpret one expression at a time it's hard to predict both the depth of the current subtree and the number of expressions that are left to interpret in other branches. I've achieved some progress by splitting expressions into separate subroutines based on the size of the code generated so far (i.e. code size threshold), but more often than not I'll get some stupid subroutines like this one:

      public static double subroutine2(double[] input) {
          return 22.640634908349323;
      }
      

      That's why I took a simpler approach and attempted to optimize an interpreter that caused trouble in the first place - the R one. I slightly modified its behavior: when the binary expressions count threshold is exceeded, it no longer split them into separate variable assignments, but moves them into their own subroutines. Although it might not be the most optimal way for simpler models (like linear ones), it helps tremendously with gradient boosting and random forest models. Since those models are summation of independent estimators, we end up putting every N (5 by default) estimators into their own subroutine, improving this way the execution time. @StrikerRUS please let me know what you think.

      opened by izeigerman 14
    • enhance classifiers, add PyPI badges and long description for PyPI

      enhance classifiers, add PyPI badges and long description for PyPI

      Python 3.4 reached its End of Life this spring and there is no need to support it anymore. https://devguide.python.org/devcycle/#end-of-life-branches

      opened by StrikerRUS 13
    • added possibility to write generated code into file

      added possibility to write generated code into file

      Closed #110.

      Real-life frustrating example:

      import sys
      
      from sklearn.datasets import load_boston
      
      import lightgbm as lgb
      import m2cgen as m2c
      
      X, y = load_boston(True)
      est = lgb.LGBMRegressor(n_estimators=1000).fit(X, y)
      
      sys.setrecursionlimit(1<<30)
      print(m2c.export_to_python(est))
      
      IOPub data rate exceeded.
      The notebook server will temporarily stop sending output
      to the client in order to avoid crashing it.
      To change this limit, set the config variable
      `--NotebookApp.iopub_data_rate_limit`.
      
      Current values:
      NotebookApp.iopub_data_rate_limit=1000000.0 (bytes/sec)
      NotebookApp.rate_limit_window=3.0 (secs)
      

      m2c.export_to_python(est, 'test.txt') works fine in this scenario.

      opened by StrikerRUS 12
    • Dart language support

      Dart language support

      For those building Flutter apps that would like to be able to utilize static models trained in scikit on-device, this tool would be a perfect fit. And if the Flutter dev team decides to add a hot code push feature to the framework, models from m2cgen could be updated on the fly.

      opened by mattc-eostar 11
    • added support for PowerShell

      added support for PowerShell

      With this PR Windows users will be able to execute ML models from "command line" without the need to install any programming language (PowerShell is already installed in Windows).

      opened by StrikerRUS 11
    • Code generated from XGBoost model includes

      Code generated from XGBoost model includes "None"

      When transpiling XGBRegressor and XGBClassifier models such as the following basic example:

      from xgboost import XGBRegressor
      from sklearn import datasets
      import m2cgen as m2c
      
      iris_data = datasets.load_iris(return_X_y=True)
      
      mod = XGBRegressor(booster="gblinear", max_depth=2)
      X, y = iris_data
      mod.fit(X[:120], y[:120])
      
      code = m2c.export_to_c(mod)
      
      print(code)
      

      the resulting c-code includes a Pythonesque None :

      double score(double * input) {
          return (None) + (((((-0.391196) + ((input[0]) * (-0.0196191))) + ((input[1]) * (-0.11313))) + ((input[2]) * (0.137024))) + ((input[3]) * (0.645197)));
      }
      

      Probably I am missing some basic step?

      opened by robinvanemden 10
    • fix typo

      fix typo

      The usage example is for python

      opened by Alisa-lisa 10
    • Bump xgboost from 1.4.2 to 1.5.2

      Bump xgboost from 1.4.2 to 1.5.2

      Bumps xgboost from 1.4.2 to 1.5.2.

      Release notes

      Sourced from xgboost's releases.

      1.5.2 Patch Release

      This is a patch release for compatibility with latest dependencies and bug fixes.

      • [dask] Fix asyncio with latest dask and distributed.
      • [R] Fix single sample SHAP prediction.
      • [Python] Update python classifier to indicate support for latest Python versions.
      • [Python] Fix with latest mypy and pylint.
      • Fix indexing type for bitfield, which may affect missing value and categorical data.
      • Fix num_boosted_rounds for linear model.

      1.5.1 Patch Release

      This is a patch release for compatibility with the latest dependencies and bug fixes. Also, all GPU-compatible binaries are built with CUDA 11.0.

      • [Python] Handle missing values in dataframe with category dtype. (#7331)

      • [R] Fix R CRAN failures about prediction and some compiler warnings.

      • [JVM packages] Fix compatibility with latest Spark (#7438, #7376)

      • Support building with CTK11.5. (#7379)

      • Check user input for iteration in inplace predict.

      • Handle OMP_THREAD_LIMIT environment variable.

      • [doc] Fix broken links. (#7341)

      Artifacts

      You can verify the downloaded packages by running this on your Unix shell:

      echo "<hash> <artifact>" | shasum -a 256 --check
      
      3a6cc7526c0dff1186f01b53dcbac5c58f12781988400e2d340dda61ef8d14ca  xgboost_r_gpu_linux_afb9dfd4210e8b8db8fe03380f83b404b1721443.tar.gz
      6f74deb62776f1e2fd030e1fa08b93ba95b32ac69cc4096b4bcec3821dd0a480  xgboost_r_gpu_win64_afb9dfd4210e8b8db8fe03380f83b404b1721443.tar.gz
      565dea0320ed4b6f807dbb92a8a57e86ec16db50eff9a3f405c651d1f53a259d  xgboost.tar.gz
      

      Release 1.5.0 stable

      This release comes with many exciting new features and optimizations, along with some bug fixes. We will describe the experimental categorical data support and the external memory interface independently. Package-specific new features will be listed in respective sections.

      Development on categorical data support

      In version 1.3, XGBoost introduced an experimental feature for handling categorical data natively, without one-hot encoding. XGBoost can fit categorical splits in decision trees. (Currently, the generated splits will be of form x \in {v}, where the input is compared to a single category value. A future version of XGBoost will generate splits that compare the input against a list of multiple category values.)

      Most of the other features, including prediction, SHAP value computation, feature importance, and model plotting were revised to natively handle categorical splits. Also, all Python interfaces including native interface with and without quantized DMatrix,

      ... (truncated)

      Changelog

      Sourced from xgboost's changelog.

      XGBoost Change Log

      This file records the changes in xgboost library in reverse chronological order.

      v1.5.0 (2021 Oct 11)

      This release comes with many exciting new features and optimizations, along with some bug fixes. We will describe the experimental categorical data support and the external memory interface independently. Package-specific new features will be listed in respective sections.

      Development on categorical data support

      In version 1.3, XGBoost introduced an experimental feature for handling categorical data natively, without one-hot encoding. XGBoost can fit categorical splits in decision trees. (Currently, the generated splits will be of form x \in {v}, where the input is compared to a single category value. A future version of XGBoost will generate splits that compare the input against a list of multiple category values.)

      Most of the other features, including prediction, SHAP value computation, feature importance, and model plotting were revised to natively handle categorical splits. Also, all Python interfaces including native interface with and without quantized DMatrix, scikit-learn interface, and Dask interface now accept categorical data with a wide range of data structures support including numpy/cupy array and cuDF/pandas/modin dataframe. In practice, the following are required for enabling categorical data support during training:

      • Use Python package.
      • Use gpu_hist to train the model.
      • Use JSON model file format for saving the model.

      Once the model is trained, it can be used with most of the features that are available on the Python package. For a quick introduction, see https://xgboost.readthedocs.io/en/latest/tutorials/categorical.html

      Related PRs: (#7011, #7001, #7042, #7041, #7047, #7043, #7036, #7054, #7053, #7065, #7213, #7228, #7220, #7221, #7231, #7306)

      • Next steps

        • Revise the CPU training algorithm to handle categorical data natively and generate categorical splits
        • Extend the CPU and GPU algorithms to generate categorical splits of form x \in S where the input is compared with multiple category values. split. (#7081)

      External memory

      This release features a brand-new interface and implementation for external memory (also known as out-of-core training). (#6901, #7064, #7088, #7089, #7087, #7092, #7070, #7216). The new implementation leverages the data iterator interface, which is currently used to create DeviceQuantileDMatrix. For a quick introduction, see https://xgboost.readthedocs.io/en/latest/tutorials/external_memory.html#data-iterator . During the development of this new interface, lz4 compression is removed. (#7076).

      ... (truncated)

      Commits

      Dependabot compatibility score

      Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


      Dependabot commands and options

      You can trigger Dependabot actions by commenting on this PR:

      • @dependabot rebase will rebase this PR
      • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
      • @dependabot merge will merge this PR after your CI passes on it
      • @dependabot squash and merge will squash and merge this PR after your CI passes on it
      • @dependabot cancel merge will cancel a previously requested merge and block automerging
      • @dependabot reopen will reopen this PR if it is closed
      • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
      • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
      • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
      • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
      dependencies 
      opened by dependabot[bot] 0
    • Support export of new ML models

      Support export of new ML models

      This is meta-issue to consolidate all requests for supporting export of new machine learning models in one place.

      • [ ]
      enhancement 
      opened by StrikerRUS 0
    • Support export to new languages

      Support export to new languages

      This is meta-issue to consolidate all requests for supporting export to new programming languages in one place.

      • [ ] Verilog (#412)
      • [ ] MATLAB (#456)
      enhancement 
      opened by StrikerRUS 0
    • Use new Codecov uploader

      Use new Codecov uploader

      Feb 1, 2022, and onward: The Bash Uploader will be fully sunset and will no longer function. https://docs.codecov.com/docs/about-the-codecov-bash-uploader

      opened by StrikerRUS 0
    • Add support for multi-label classification of DecisionTreeClassifier(sklearn)

      Add support for multi-label classification of DecisionTreeClassifier(sklearn)

      This repo is awesome! It is very useful. However, I find it currently do not support for multi-label classification of DecisionTreeClassifier(sklearn). I will appreciate if that feature could be implemented.

      opened by HannanKan 1
    • invalid input value index

      invalid input value index

      ··

      opened by mccoysc 0
    • Support CalibratedClassifierCV /  CalibratedClassifier

      Support CalibratedClassifierCV / CalibratedClassifier

      https://scikit-learn.org/stable/modules/generated/sklearn.calibration.CalibratedClassifierCV.html

      it seens to be relative easy (a sigmoid function + mean)

      https://github.com/scikit-learn/scikit-learn/blob/9b033758e/sklearn/calibration.py#L388 https://github.com/scikit-learn/scikit-learn/blob/9b033758e/sklearn/calibration.py#L433

      opened by rspadim 0
    • Convert from VBA function to SAS

      Convert from VBA function to SAS

      Hello all, I have tried to use the m2cgen package in order to translate 3 specific VBA functions to SAS or R scripts. I'm sending as an attached file an Excel spreasheet that illustrates what I'e tried to accomplish. There are 3 different functions available over this Excel spreadsheet, for instance: a) COHORT: Function used to calculated a transition matrix through Cohort approach b) GENERATOR: Function used to calculated the generator matrix through Aalen-Johansen Estimator c) MEXPGENERATOR: Function used to translate the generator matrix in probabilities

      I'd be so grateful if you are able to help me on that.

      Thanks in advance. Best Regards, Raphael

      Transition Matrix_VBA Functions.zip

      opened by raphaelchaves 0
    • taking address of temporary array

      taking address of temporary array

      XGBoost Classifier generated code for objective = 'binary:logistic', does not compile in c++

      The last line that copies the prediction to what i am assuming to be a 0 or 1 sigmoid output value.

      memcpy(output, (const double[]){(1.0) - (var1000), var1000}, 2 * sizeof(double));
      

      gives this error:

      error: taking address of temporary array
           memcpy(output, (double[]){(1.0) - (var1000), var1000}, 2 * sizeof(double));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      

      it highlights this part:

      {(1.0) - (var1000), var1000}
      

      does anyone know how I can fix this error? And what if I just returned the raw values from var1000 could that work also?

      Compiler:

      g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
      

      CXX_FLAGS

      -std=c++11
      
      opened by jdubz93 5
    • Any limit in export_to_c ? I am getting some python crash with large XGBoost model

      Any limit in export_to_c ? I am getting some python crash with large XGBoost model

      xgb is my trained XGBoost model with .fit method The model is rather large with 3000 trees and depth of 8

      I save the model as a txt file and it is rather large 28.5 MB using xgb.get_booster().dump_model('xgb_model_rules.txt', with_stats = True)

      then I want to convert to some c code (I am trying some post-editing to make it a MATLAB code)

      code = m2c.export_to_c(xgb) print("write the code to a text file") text_file = open("xgb_c.txt", "w") text_file.write("C code for the XGB structure: %s" % code) text_file.close()

      my python (version 3.8.10) crashes during code = m2c.export_to_c(xgb) ...

      Any suggestions ? I tried with a smaller boston data set resulting in a smaller model and it works fine.

      I can share the xgb_model_rules.txt if needed

      opened by bhamadicharef 8
    Releases(v0.9.0)
    • v0.9.0(Sep 18, 2020)

      • Python 3.5 is no longer supported.
      • Trained models can now be transpiled into F# 🎉 .
      • Model support:
        • Added support for GLM models from the scikit-learn package.
        • Introduced support for a variety of objectives in LightGBM models.
        • The cauchy function is now supported for GLM models.
      • Improved conversion of floating point numbers into string literals. This leads to improved accuracy of results returned by generated code.
      • Improved handling of missing values in LightGBM models. Kudos to our first time contributor @Aulust 🎉
      • Various improvements of the code generation runtime.
      Source code(tar.gz)
      Source code(zip)
    • v0.8.0(Jun 18, 2020)

      • This release is the last one which supports Python 3.5. Next release will require Python >= 3.6.
      • Trained models can now be transpiled into Haskell and Ruby 🎉
      • Various improvements of the code generation runtime:
        • Introduced caching of the interpreter handler names.
        • A string buffer is now used to store generated code.
        • We moved away from using the string.Template.
      • The numpy dependency is no longer required at runtime for the generated Python code.
      • Improved model support:
        • Enabled multiclass support for XGBoost Random Forest models.
        • Added support of Boosted Random Forest models from the XGBoost package.
        • Added support of GLM models from the statsmodels package.
      • Introduced fallback expressions for a variety of functions which rely on simpler language constructs. This should simplify implementation of new interpreters since the number of functions that must be provided by the standard library or by a developer of the given interpreter has been reduced. Note that fallback expressions are optional and can be overridden by a manually written implementation or a corresponding function from the standard library. Among functions for which fallback AST expressions have been introduced are: abs, tanh, sqrt, exp, sigmoid and softmax.

      Kudos to @StrikerRUS who's responsible for all these amazing updates 💪

      Source code(tar.gz)
      Source code(zip)
    • v0.7.0(Apr 7, 2020)

      • Bug fixes:
        • Thresholds for XGBoost trees are forced to be float32 now (https://github.com/BayesWitnesses/m2cgen/issues/168).
        • Fixed support for newer versions of XGBoost, in which the default value for the base_score parameter became None (https://github.com/BayesWitnesses/m2cgen/issues/182).
      • Models can now be transpiled into the Dart language. Kudos to @MattConflitti for this great addition 🎉
      • Support for following models has been introduced:
        • Models from the statsmodels package are now supported. The list of added models includes: GLS, GLSAR, OLS, ProcessMLE, QuantReg and WLS.
        • Models from the lightning package: AdaGradRegressor/AdaGradClassifier, CDRegressor/CDClassifier, FistaRegressor/FistaClassifier, SAGARegressor/SAGAClassifier, SAGRegressor/SAGClassifier, SDCARegressor/SDCAClassifier, SGDClassifier, LinearSVR/LinearSVC and KernelSVC.
        • RANSACRegressor from the scikit-learn package.
      • The name of the scoring function can now be changed via a parameter. Thanks @mrshu 💪
      • The SubroutineExpr expression has been removed from AST. The logic of how to split the generated code into subroutines is now focused in interpreters and was completely removed from assemblers.
      Source code(tar.gz)
      Source code(zip)
    • v0.6.0(Feb 17, 2020)

      • Trained models can now be transpiled into R, PowerShell and PHP. Major effort delivered solely by @StrikerRUS .
      • In Java interpreter introduced a logic that splits code into methods that is based on heuristics and which doesn't rely on SubroutineExpr from AST.
      • Added support of LightGBM and XGBoost Random Forest models.
      • XGBoost linear models are now supported.
      • LassoLarsCV, Perceptron and PassiveAggressiveClassifier estimators from scikit-learn package are now supported.
      Source code(tar.gz)
      Source code(zip)
    • v0.5.0(Dec 1, 2019)

      Quite a few awesome updates in this release. Many thanks to @StrikerRUS and @chris-smith-zocdoc for making this release happen.

      • Visual Basic and C# joined the list of supported languages. Thanks @StrikerRUS for all the hard work!
      • The numpy dependency is no longer required for generated Python code when no linear algebra is involved. Thanks @StrikerRUS for this update.
      • Fixed the bug when generated Java code exceeded the JVM method size constraints in case when individual estimators of a GBT model contained a large number of leaves. Kudos to @chris-smith-zocdoc for discovering and fixing this issue.
      Source code(tar.gz)
      Source code(zip)
    • v0.4.0(Sep 28, 2019)

    • v0.3.1(Aug 15, 2019)

      • Fixed generation of XGBoost models in case when feature names are not specified in a model object (https://github.com/BayesWitnesses/m2cgen/pull/93). Thanks @akhvorov for contributing the fix.
      Source code(tar.gz)
      Source code(zip)
    • v0.3.0(May 21, 2019)

    • v0.2.1(Apr 17, 2019)

      • For XGBoost models add support of the best_ntree_limit attribute to limit the number of estimators used during prediction. Thanks @arshamg for helping with that.
      Source code(tar.gz)
      Source code(zip)
    • v0.2.0(Mar 22, 2019)

      • Golang joins the family of languages supported by m2cgen 🎉 Credit goes to @matbur for making such a significant contribution 🥇
      • For generated C code the custom assign_array function that was used to assign vector values has been replaced with plain memcpy.
      Source code(tar.gz)
      Source code(zip)
    • v0.1.1(Mar 5, 2019)

    • v0.1.0(Feb 12, 2019)

    Owner
    Bayes' Witnesses
    Bayes' Witnesses
    Example of Neural Network models of social and personality psychology phenomena

    SocialNN Example of Neural Network models of social and personality psychology phenomena This repository gathers a collection of neural network models

    null 6 Jan 15, 2022
    A collection of basic tools that make working with polynomials easier in Go

    PolyGo A collection of basic tools that make working with polynomials easier in

    Sean Xie 16 Jan 8, 2022
    A native Go clean room implementation of the Porter Stemming algorithm.

    Go Porter Stemmer A native Go clean room implementation of the Porter Stemming Algorithm. This algorithm is of interest to people doing Machine Learni

    Charles Iliya Krempeaux 179 Oct 15, 2021
    A Kubernetes Native Batch System (Project under CNCF)

    Volcano is a batch system built on Kubernetes. It provides a suite of mechanisms that are commonly required by many classes of batch & elastic workloa

    Volcano 2.2k Jan 17, 2022
    Katib is a Kubernetes-native project for automated machine learning (AutoML).

    Katib is a Kubernetes-native project for automated machine learning (AutoML). Katib supports Hyperparameter Tuning, Early Stopping and Neural Architec

    Kubeflow 1.1k Jan 14, 2022
    Turn shell commands into web services

    webify Turn functions and commands into web services For a real world example, see turning a Python function into a web service. Overview webify is a

    Michael Alexander 892 Jan 11, 2022
    a cheat-sheet for mathematical notation in code form

    math-as-code Chinese translation (中文版) Python version (English) This is a reference to ease developers into mathematical notation by showing compariso

    Jam3 13.9k Jan 22, 2022
    Advent of Code 2016 in Go using only GitHub Copilot

    Advent of Gopilot Solutions to Advent of Code 2016 in Go using only GitHub Copilot. "Rules" The idea is to have GitHub Copilot generate all the actual

    Sarek Høverstad Skotåm 3 Nov 16, 2021
    atwhy is a tool to describe your decisions inside the code where they are actually made and still get a readable documentation.

    atwhy What is atwhy atwhy can be used to generate a documentation out of comments in the code. That way you can for example describe all available opt

    Tiffinger & Thiel GmbH 4 Jan 10, 2022
    Quiz master - Code Submission for Testing Backend Skills

    Quiz Master Code Submission for Testing Backend Skills Running App Setting up ./

    Surya Dewangga 1 Jan 12, 2022
    PHP functions implementation to Golang. This package is for the Go beginners who have developed PHP code before. You can use PHP like functions in your app, module etc. when you add this module to your project.

    PHP Functions for Golang - phpfuncs PHP functions implementation to Golang. This package is for the Go beginners who have developed PHP code before. Y

    Serkan Algur 45 Jan 14, 2022
    XSD (XML Schema Definition) parser and Go/C/Java/Rust/TypeScript code generator

    xgen Introduction xgen is a library written in pure Go providing a set of functions that allow you to parse XSD (XML schema definition) files. This li

    null 131 Jan 14, 2022
    Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package.

    Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package. The library allows you to call Go service methods from PHP with a minimal footprint, structures and []byte support.

    Spiral Scout 1.1k Jan 15, 2022
    Go API backed by the native Dart Sass Embedded executable.

    This is a Go API backed by the native Dart Sass Embedded executable. The primary motivation for this project is to provide SCSS support to Hugo. I wel

    Bjørn Erik Pedersen 18 Jan 17, 2022
    A Cloud Native Buildpack that contributes SDKMAN and uses it to install dependencies like the Java Virtual Machine

    gcr.io/paketo-buildpacks/sdkman A Cloud Native Buildpack that contributes SDKMAN and uses it to install dependencies like the Java Virtual Machine. Be

    Daniel Mikusa 1 Jan 8, 2022
    Transform Go code into it's AST

    Welcome to go2ast ?? Transform Go code into it's AST Usage echo "a := 1" | go run main.go Example output []ast.Stmt { &ast.AssignStmt {

    Eli Yukelzon 85 Jan 13, 2022
    Aes for go and java; build go fo wasm and use wasm parse java response.

    aes_go_wasm_java aes for go and java; build go fo wasm and use wasm parse java response. vscode setting config settings.json { "go.toolsEnvVars":

    忆年 0 Dec 14, 2021
    Update-java-ca-certificates - Small utility to convert the system trust store to a system Java KeyStore

    update-java-ca-certificates This small utility takes care of creating a system-w

    Swisscom 3 Jan 7, 2022
    Haskell-flavoured functions for Go :smiley:

    Hasgo Coverage status: gocover.io Our report card: Hasgo is a code generator with functions influenced by Haskell. It comes with some types out-of-the

    Dylan Meeus 108 Jan 16, 2022
    go-for-php php-to-go

    easy-func 项目介绍 使用 golang 来翻译 php 函数。可以看做php函数在golang的映射字典。

    null 9 Oct 22, 2021
    Golang->Haxe->CPP/CSharp/Java/JavaScript transpiler

    TARDIS Go -> Haxe transpiler Haxe -> C++ / C# / Java / JavaScript Project status: a non-working curiosity, development currently on-ice The advent of

    TARDIS Go 414 Dec 28, 2021
    Go -> Haxe -> JS Java C# C++ C Python Lua

    go2hx Compile: Go -> Haxe -> Js, Lua, C#, C++, Java, C, Python warning: heavily experimental still a ways to go before an alpha. Come give feedback on

    go2hx 46 Jan 9, 2022
    Highly configurable prompt builder for Bash, ZSH and PowerShell written in Go.

    Go Bullet Train (GBT) Highly configurable prompt builder for Bash, ZSH and PowerShell written in Go. It's inspired by the Oh My ZSH Bullet Train theme

    Jiri Tyr 502 Jan 18, 2022
    Lightweight rest api that allows users to run Powershell commands over HTTP.

    Powershell Proxy Lightweight rest api that allows users to run Powershell commands over HTTP. Requests require a valid JWT and responses are returned

    Thomas Sampson 3 Dec 14, 2021
    omniparser: a native Golang ETL streaming parser and transform library for CSV, JSON, XML, EDI, text, etc.

    omniparser Omniparser is a native Golang ETL parser that ingests input data of various formats (CSV, txt, fixed length/width, XML, EDI/X12/EDIFACT, JS

    JF Technology 409 Jan 18, 2022
    churro is a cloud-native Extract-Transform-Load (ETL) application designed to build, scale, and manage data pipeline applications.

    Churro - ETL for Kubernetes churro is a cloud-native Extract-Transform-Load (ETL) application designed to build, scale, and manage data pipeline appli

    churrodata 7 Jan 7, 2022