From 067a70889fc59ed58cfd321b1112207ba89098b8 Mon Sep 17 00:00:00 2001 From: Iaroslav Zeigerman Date: Wed, 15 May 2019 13:50:15 -0700 Subject: [PATCH] Indicate SVM support in the README (#91) --- README.md | 94 +++++++++++++++++++------------------------------------ 1 file changed, 32 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 7a7d6640..7ce1e210 100644 --- a/README.md +++ b/README.md @@ -29,73 +29,43 @@ pip install m2cgen - Go ## Supported Models - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ClassificationRegression
LinearLogisticRegression, LogisticRegressionCV, RidgeClassifier, RidgeClassifierCV, SGDClassifier, PassiveAggressiveClassifierLinearRegression, HuberRegressor, ElasticNet, ElasticNetCV, TheilSenRegressor, Lars, LarsCV, Lasso, LassoCV, LassoLars, LassoLarsIC, OrthogonalMatchingPursuit, OrthogonalMatchingPursuitCV, Ridge, RidgeCV, BayesianRidge, ARDRegression, SGDRegressor, PassiveAggressiveRegressor
SVMLinearSVCLinearSVR
TreeDecisionTreeClassifier, ExtraTreeClassifierDecisionTreeRegressor, ExtraTreeRegressor
Random ForestRandomForestClassifier, ExtraTreesClassifierRandomForestRegressor, ExtraTreesRegressor
BoostingXGBClassifier(gbtree/dart booster only), LGBMClassifier(gbdt/dart booster only)XGBRegressor(gbtree/dart booster only), LGBMRegressor(gbdt/dart booster only)
+| | Classification | Regression | +| --- | --- | --- | +| **Linear** | LogisticRegression, LogisticRegressionCV, RidgeClassifier, RidgeClassifierCV, SGDClassifier, PassiveAggressiveClassifier | LinearRegression, HuberRegressor, ElasticNet, ElasticNetCV, TheilSenRegressor, Lars, LarsCV, Lasso, LassoCV, LassoLars, LassoLarsIC, OrthogonalMatchingPursuit, OrthogonalMatchingPursuitCV, Ridge, RidgeCV, BayesianRidge, ARDRegression, SGDRegressor, PassiveAggressiveRegressor | +| **SVM** | SVC, NuSVC, LinearSVC | SVR, NuSVR, LinearSVR | +| **Tree** | DecisionTreeClassifier, ExtraTreeClassifier | DecisionTreeRegressor, ExtraTreeRegressor | +| **Random Forest** | RandomForestClassifier, ExtraTreesClassifier | RandomForestRegressor, ExtraTreesRegressor | +| **Boosting** | XGBClassifier(gbtree/dart booster only), LGBMClassifier(gbdt/dart booster only) | XGBRegressor(gbtree/dart booster only), LGBMRegressor(gbdt/dart booster only) | ## Classification Output - - - - - - - - - - - - - - - - - - - - - - - -
BinaryMulticlassComment
LinearScalar value; signed distance of the sample to the hyperplane for the second class Vector value; signed distance of the sample to the hyperplane per each classThe output is consistent with the output of LinearClassifierMixin.decision_function
Tree/Random Forest/XGBoost/LightGBMVector value; class probabilitiesVector value; class probabilitiesThe output is consistent with the output of the predict_proba method of DecisionTreeClassifier/ForestClassifier/XGBClassifier/LGBMClassifier
+### Linear/Linear 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 +#### 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/XGBoost/LightGBM +#### 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`/`ForestClassifier`/`XGBClassifier`/`LGBMClassifier`. ## Usage -Here's a simple example of how a trained linear model can be represented in Java code: +Here's a simple example of how a linear model trained in Python environment can be represented in Java code: ```python from sklearn.datasets import load_boston from sklearn import linear_model @@ -110,7 +80,7 @@ estimator.fit(X, y) code = m2c.export_to_java(estimator) ``` -The example of the generated code: +Generated Java code: ```java public class Model {