Package: sklearn-export
sklearn-exportThis package is based on sklearn porter fromhttps://github.com/nok/sklearn-porter.  I choose to build it because sklearn porter saves data in matrix format. However, most popular algebra libraries (e.g.,blasandlapack) are used to work with vectors. Then, sklearn-export saves the sklearn model data in Json format (matrices are stored incolumn major order).  Note that, this is a beta version yet, then only some models and functionalities are supported.New features (0.0.7)The code was optimized and now it works with sklearn >= 0.24. Some complete examples were added (see Complete Examples section).SupportClassDetailssklearn.svm.SVCC-Support Vector Classification. The multiclass support is handled according to a one-vs-one scheme.sklearn.svm.NuSVCNu-Support Vector Classification. Similar to SVC but uses a parameter to control the number of support vectors.sklearn.svc.LinearSVCLinear Support Vector Classification.sklearn.neural_network.MLPClassifierMulti-layer Perceptron classifier.sklearn.neural_network.MLPRegressorMulti-layer Perceptron regressor.sklearn.linear_model.LogisticRegressionLogistic Regression (aka logit, MaxEnt) classifier.sklearn.linear_model.LinearRegressionOrdinary least squares Linear Regression.sklearn.preprocessing.MinMaxScalerTransforms features by scaling each feature to a given range.sklearn.preprocessing.StandardScalerStandardize features by removing the mean and scaling to unit variance.sklearn.svm.SVREpsilon-Support Vector Regression.sklearn.svm.LinearSVRLinear Support Vector Regression.Observation: details were extracted from sklearn documentation.InstallationWe recommend to make a instalation using pip:$pipinstallsklearn_exportIf you are using jupyter notebooks consider to install sklearn_export through a notebook cell. Then, you can type and execute the following:importsys!{sys.executable}-mpipinstallsklearn_exportUsageActually sklearn-export can save Classifiers, Regressions and some Scalers (see Support session).Saving a Model or ScalerThe basic usage is to save a simple model.# Basic importsfromsklearn.datasetsimportload_irisfromsklearn_exportimportExportfromsklearn.neural_networkimportMLPRegressor# Load data and train modelsamples=load_iris()X,y=samples.data,samples.targetclf=MLPRegressor()clf.fit(X,y)# Save using sklearn_exportexport=Export(clf)result=export.to_json()The result is a Json file that can be loaded in any language.Complete examplesSome complete examples are providedhere.Saving a Model and a ScalerThe sklearn-export can also save more then one class in the same Json. This is usefull to store a Classifier and a Scaler (for example). To be honest, actually is only possible to store a pair Model and Scaler.# Basic importsfromsklearn.datasetsimportload_irisfromsklearn_exportimportExportfromsklearn.preprocessingimportStandardScalerfromsklearn.neural_networkimportMLPRegressor# Load datasamples=load_iris()X,y=samples.data,samples.target# Normalize datascaler=StandardScaler()Xz=scaler.fit_transform(X)# Train model with normalized dataclf=MLPRegressor()clf.fit(Xz,y)# Save model and scaler using sklearn_exportexport=Export([scaler,clf])result=export.to_json()The result is a Json file that contains information about a Model and a Scaler. The file can be loaded in any programing language.Extra optionsThe methodto_json()also support some other parameters:ParameterDetailsDefaultfilenameName of the output Json filedata.jsondirectoryPath to save the file.with_md5_hashInclude md5 hash in file nameFalseQuestionsIf you have any question please send me a mailcharles26f@gmail.com.