Import your own SK-Learn models

Deploy-ML aims to make the process of training, testing and deploying machine learning easier and simplier. However, sometimes the model required is not directly supported, or a collegue has already defined a model. The import class is for users who define their own sk-learn model, but want to use the package for training and deployment reasons. To use your sk-learn model, import the import class:

from deployml.sklearn.models.import import ImportBase

Parameters

  • model = Sk-Learn model that you have imported and defined
  • model_title = string describing the title of the model for deployment package

Practical Example

Below is an example of importing a logistic regression model from sk-learn, and using the deploy-ml import class:

from sklearn.linear_model import LogisticRegression
from deployml.sklearn.models.import import ImportBase


imported_model = LogisticRegression(penalty=’l2’, dual=False, 
                                    tol=0.0001, C=1.0, fit_intercept=True, 
                                    intercept_scaling=1, class_weight=None, 
                                    random_state=None, solver=’liblinear’, 
                                    max_iter=100, multi_class=’ovr’, verbose=0, 
                                    warm_start=False, n_jobs=1)

model = ImportBase(model=imported_model,
                     model_title="Logistic Regression")

Now the imported model has all the training and deployment functions of deploy-ml.