实例介绍
m2cgen(Model 2 Code Generator)是一个轻量级库,提供了一种将训练好的统计模型转译为本机代码(Python、C、Java、Go、JavaScript、Visual Basic、C#、PowerShell、R、PHP、Dart、Haskell、Ruby、F#、Rust、Elixir)的简便方法。
Installation
支持的Python版本为>= 3.7。
pip install m2cgen
Supported Languages
C、C#、Dart、F#、Go、Haskell、Java、JavaScript、PHP、PowerShell、Python、R、Ruby、Rust、Visual Basic(兼容VBA)、Elixir
【实例截图】
【核心代码】
文件清单
└── m2cgen-9784632311986234032673cdbfd29fc4c5cb429d
├── Dockerfile
├── generated_code_examples
│ ├── c
│ │ ├── classification
│ │ │ ├── decision_tree.c
│ │ │ ├── lightgbm.c
│ │ │ ├── linear.c
│ │ │ ├── random_forest.c
│ │ │ ├── svm.c
│ │ │ └── xgboost.c
│ │ └── regression
│ │ ├── decision_tree.c
│ │ ├── lightgbm.c
│ │ ├── linear.c
│ │ ├── random_forest.c
│ │ ├── svm.c
│ │ └── xgboost.c
│ ├── c_sharp
│ │ ├── classification
│ │ │ ├── decision_tree.cs
│ │ │ ├── lightgbm.cs
│ │ │ ├── linear.cs
│ │ │ ├── random_forest.cs
│ │ │ ├── svm.cs
│ │ │ └── xgboost.cs
│ │ └── regression
│ │ ├── decision_tree.cs
│ │ ├── lightgbm.cs
│ │ ├── linear.cs
│ │ ├── random_forest.cs
│ │ ├── svm.cs
│ │ └── xgboost.cs
│ ├── dart
│ │ ├── classification
│ │ │ ├── decision_tree.dart
│ │ │ ├── lightgbm.dart
│ │ │ ├── linear.dart
│ │ │ ├── random_forest.dart
│ │ │ ├── svm.dart
│ │ │ └── xgboost.dart
│ │ └── regression
│ │ ├── decision_tree.dart
│ │ ├── lightgbm.dart
│ │ ├── linear.dart
│ │ ├── random_forest.dart
│ │ ├── svm.dart
│ │ └── xgboost.dart
│ ├── elixir
│ │ ├── classification
│ │ │ ├── decision_tree.ex
│ │ │ ├── lightgbm.ex
│ │ │ ├── linear.ex
│ │ │ ├── random_forest.ex
│ │ │ ├── svm.ex
│ │ │ └── xgboost.ex
│ │ └── regression
│ │ ├── decision_tree.ex
│ │ ├── lightgbm.ex
│ │ ├── linear.ex
│ │ ├── random_forest.ex
│ │ ├── svm.ex
│ │ └── xgboost.ex
│ ├── f_sharp
│ │ ├── classification
│ │ │ ├── decision_tree.fs
│ │ │ ├── lightgbm.fs
│ │ │ ├── linear.fs
│ │ │ ├── random_forest.fs
│ │ │ ├── svm.fs
│ │ │ └── xgboost.fs
│ │ └── regression
│ │ ├── decision_tree.fs
│ │ ├── lightgbm.fs
│ │ ├── linear.fs
│ │ ├── random_forest.fs
│ │ ├── svm.fs
│ │ └── xgboost.fs
│ ├── go
│ │ ├── classification
│ │ │ ├── decision_tree.go
│ │ │ ├── lightgbm.go
│ │ │ ├── linear.go
│ │ │ ├── random_forest.go
│ │ │ ├── svm.go
│ │ │ └── xgboost.go
│ │ └── regression
│ │ ├── decision_tree.go
│ │ ├── lightgbm.go
│ │ ├── linear.go
│ │ ├── random_forest.go
│ │ ├── svm.go
│ │ └── xgboost.go
│ ├── haskell
│ │ ├── classification
│ │ │ ├── decision_tree.hs
│ │ │ ├── lightgbm.hs
│ │ │ ├── linear.hs
│ │ │ ├── random_forest.hs
│ │ │ ├── svm.hs
│ │ │ └── xgboost.hs
│ │ └── regression
│ │ ├── decision_tree.hs
│ │ ├── lightgbm.hs
│ │ ├── linear.hs
│ │ ├── random_forest.hs
│ │ ├── svm.hs
│ │ └── xgboost.hs
│ ├── java
│ │ ├── classification
│ │ │ ├── decision_tree.java
│ │ │ ├── lightgbm.java
│ │ │ ├── linear.java
│ │ │ ├── random_forest.java
│ │ │ ├── svm.java
│ │ │ └── xgboost.java
│ │ └── regression
│ │ ├── decision_tree.java
│ │ ├── lightgbm.java
│ │ ├── linear.java
│ │ ├── random_forest.java
│ │ ├── svm.java
│ │ └── xgboost.java
│ ├── javascript
│ │ ├── classification
│ │ │ ├── decision_tree.js
│ │ │ ├── lightgbm.js
│ │ │ ├── linear.js
│ │ │ ├── random_forest.js
│ │ │ ├── svm.js
│ │ │ └── xgboost.js
│ │ └── regression
│ │ ├── decision_tree.js
│ │ ├── lightgbm.js
│ │ ├── linear.js
│ │ ├── random_forest.js
│ │ ├── svm.js
│ │ └── xgboost.js
│ ├── php
│ │ ├── classification
│ │ │ ├── decision_tree.php
│ │ │ ├── lightgbm.php
│ │ │ ├── linear.php
│ │ │ ├── random_forest.php
│ │ │ ├── svm.php
│ │ │ └── xgboost.php
│ │ └── regression
│ │ ├── decision_tree.php
│ │ ├── lightgbm.php
│ │ ├── linear.php
│ │ ├── random_forest.php
│ │ ├── svm.php
│ │ └── xgboost.php
│ ├── powershell
│ │ ├── classification
│ │ │ ├── decision_tree.ps1
│ │ │ ├── lightgbm.ps1
│ │ │ ├── linear.ps1
│ │ │ ├── random_forest.ps1
│ │ │ ├── svm.ps1
│ │ │ └── xgboost.ps1
│ │ └── regression
│ │ ├── decision_tree.ps1
│ │ ├── lightgbm.ps1
│ │ ├── linear.ps1
│ │ ├── random_forest.ps1
│ │ ├── svm.ps1
│ │ └── xgboost.ps1
│ ├── python
│ │ ├── classification
│ │ │ ├── decision_tree.py
│ │ │ ├── lightgbm.py
│ │ │ ├── linear.py
│ │ │ ├── random_forest.py
│ │ │ ├── svm.py
│ │ │ └── xgboost.py
│ │ └── regression
│ │ ├── decision_tree.py
│ │ ├── lightgbm.py
│ │ ├── linear.py
│ │ ├── random_forest.py
│ │ ├── svm.py
│ │ └── xgboost.py
│ ├── r
│ │ ├── classification
│ │ │ ├── decision_tree.r
│ │ │ ├── lightgbm.r
│ │ │ ├── linear.r
│ │ │ ├── random_forest.r
│ │ │ ├── svm.r
│ │ │ └── xgboost.r
│ │ └── regression
│ │ ├── decision_tree.r
│ │ ├── lightgbm.r
│ │ ├── linear.r
│ │ ├── random_forest.r
│ │ ├── svm.r
│ │ └── xgboost.r
│ ├── ruby
│ │ ├── classification
│ │ │ ├── decision_tree.rb
│ │ │ ├── lightgbm.rb
│ │ │ ├── linear.rb
│ │ │ ├── random_forest.rb
│ │ │ ├── svm.rb
│ │ │ └── xgboost.rb
│ │ └── regression
│ │ ├── decision_tree.rb
│ │ ├── lightgbm.rb
│ │ ├── linear.rb
│ │ ├── random_forest.rb
│ │ ├── svm.rb
│ │ └── xgboost.rb
│ ├── rust
│ │ ├── classification
│ │ │ ├── decision_tree.rs
│ │ │ ├── lightgbm.rs
│ │ │ ├── linear.rs
│ │ │ ├── random_forest.rs
│ │ │ ├── svm.rs
│ │ │ └── xgboost.rs
│ │ └── regression
│ │ ├── decision_tree.rs
│ │ ├── lightgbm.rs
│ │ ├── linear.rs
│ │ ├── random_forest.rs
│ │ ├── svm.rs
│ │ └── xgboost.rs
│ └── visual_basic
│ ├── classification
│ │ ├── decision_tree.vb
│ │ ├── lightgbm.vb
│ │ ├── linear.vb
│ │ ├── random_forest.vb
│ │ ├── svm.vb
│ │ └── xgboost.vb
│ └── regression
│ ├── decision_tree.vb
│ ├── lightgbm.vb
│ ├── linear.vb
│ ├── random_forest.vb
│ ├── svm.vb
│ └── xgboost.vb
├── LICENSE
├── m2cgen
│ ├── assemblers
│ │ ├── base.py
│ │ ├── boosting.py
│ │ ├── ensemble.py
│ │ ├── fallback_expressions.py
│ │ ├── __init__.py
│ │ ├── linear.py
│ │ ├── meta.py
│ │ ├── svm.py
│ │ ├── tree.py
│ │ └── utils.py
│ ├── ast.py
│ ├── cli.py
│ ├── exporters.py
│ ├── __init__.py
│ ├── interpreters
│ │ ├── c
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.c
│ │ │ ├── sigmoid.c
│ │ │ └── softmax.c
│ │ ├── code_generator.py
│ │ ├── c_sharp
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.cs
│ │ │ ├── log1p.cs
│ │ │ ├── sigmoid.cs
│ │ │ └── softmax.cs
│ │ ├── dart
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.dart
│ │ │ ├── log1p.dart
│ │ │ ├── sigmoid.dart
│ │ │ ├── softmax.dart
│ │ │ └── tanh.dart
│ │ ├── elixir
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.ex
│ │ │ ├── log1p.ex
│ │ │ ├── sigmoid.ex
│ │ │ └── softmax.ex
│ │ ├── f_sharp
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.fs
│ │ │ ├── log1p.fs
│ │ │ ├── sigmoid.fs
│ │ │ └── softmax.fs
│ │ ├── go
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.go
│ │ │ ├── sigmoid.go
│ │ │ └── softmax.go
│ │ ├── haskell
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.hs
│ │ │ ├── log1p.hs
│ │ │ ├── sigmoid.hs
│ │ │ └── softmax.hs
│ │ ├── __init__.py
│ │ ├── interpreter.py
│ │ ├── java
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.java
│ │ │ ├── sigmoid.java
│ │ │ └── softmax.java
│ │ ├── javascript
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.js
│ │ │ ├── sigmoid.js
│ │ │ └── softmax.js
│ │ ├── mixins.py
│ │ ├── php
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.php
│ │ │ ├── sigmoid.php
│ │ │ └── softmax.php
│ │ ├── powershell
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.ps1
│ │ │ ├── log1p.ps1
│ │ │ ├── sigmoid.ps1
│ │ │ └── softmax.ps1
│ │ ├── python
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.py
│ │ │ ├── sigmoid.py
│ │ │ └── softmax.py
│ │ ├── r
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── sigmoid.r
│ │ │ └── softmax.r
│ │ ├── ruby
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.rb
│ │ │ ├── log1p.rb
│ │ │ ├── sigmoid.rb
│ │ │ └── softmax.rb
│ │ ├── rust
│ │ │ ├── code_generator.py
│ │ │ ├── __init__.py
│ │ │ ├── interpreter.py
│ │ │ ├── linear_algebra.rs
│ │ │ ├── sigmoid.rs
│ │ │ └── softmax.rs
│ │ ├── utils.py
│ │ └── visual_basic
│ │ ├── atan.bas
│ │ ├── code_generator.py
│ │ ├── __init__.py
│ │ ├── interpreter.py
│ │ ├── linear_algebra.bas
│ │ ├── log1p.bas
│ │ ├── sigmoid.bas
│ │ ├── softmax.bas
│ │ └── tanh.bas
│ ├── __main__.py
│ └── VERSION.txt
├── Makefile
├── MANIFEST.in
├── README.md
├── requirements-test.txt
├── setup.cfg
├── setup.py
├── tests
│ ├── assemblers
│ │ ├── __init__.py
│ │ ├── test_boosting_lightgbm.py
│ │ ├── test_boosting_xgboost.py
│ │ ├── test_ensemble.py
│ │ ├── test_linear_lightning.py
│ │ ├── test_linear_sklearn.py
│ │ ├── test_linear_statsmodels.py
│ │ ├── test_meta.py
│ │ ├── test_svm_lightning.py
│ │ ├── test_svm_sklearn.py
│ │ ├── test_tree.py
│ │ └── utils.py
│ ├── conftest.py
│ ├── e2e
│ │ ├── executors
│ │ │ ├── base.py
│ │ │ ├── c.py
│ │ │ ├── c_sharp.py
│ │ │ ├── dart.py
│ │ │ ├── elixir.py
│ │ │ ├── Executor.java
│ │ │ ├── f_sharp.py
│ │ │ ├── go.py
│ │ │ ├── haskell.py
│ │ │ ├── __init__.py
│ │ │ ├── java.py
│ │ │ ├── javascript.py
│ │ │ ├── php.py
│ │ │ ├── powershell.py
│ │ │ ├── python.py
│ │ │ ├── r.py
│ │ │ ├── ruby.py
│ │ │ ├── rust.py
│ │ │ └── visual_basic.py
│ │ ├── __init__.py
│ │ ├── test_cli.py
│ │ └── test_e2e.py
│ ├── __init__.py
│ ├── interpreters
│ │ ├── __init__.py
│ │ ├── test_c.py
│ │ ├── test_c_sharp.py
│ │ ├── test_dart.py
│ │ ├── test_elixir.py
│ │ ├── test_f_sharp.py
│ │ ├── test_go.py
│ │ ├── test_haskell.py
│ │ ├── test_java.py
│ │ ├── test_javascript.py
│ │ ├── test_php.py
│ │ ├── test_powershell.py
│ │ ├── test_python.py
│ │ ├── test_r.py
│ │ ├── test_ruby.py
│ │ ├── test_rust.py
│ │ └── test_visual_basic.py
│ ├── test_ast.py
│ ├── test_cli.py
│ ├── test_exporters.py
│ ├── test_fallback_expressions.py
│ └── utils.py
└── tools
├── generate_code_examples.py
└── __init__.py
75 directories, 387 files
标签:
m2cgen: 将机器学习模型转换为本机代码(Java、C、Python、Go、JavaScript、Visual Basic、C#、R、PowerShell、PHP、Dart、Haskell、Ruby、F#、R…)
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论