Deploying

Deploying with mlrequest-python

To deploy scikit-learn models, you will need the mlrequest-python package. Please consult the list of supported scikit-learn models to be sure your model can be deployed with mlrequest. Requests for new models or features can be sent to support@mlrequest.com.

Deploying Scikit-Learn Models to A Single Data Center

If you have a free or single-region paid account, then you are only permitted to deploy scikit-learn models to a single data center.

Models deployed to a single region will still benefit from high-availability and will automatically failover to another data center if service becomes unavailable.

To deploy to a single datacenter you must specify a region from the available regions in mlrequest-python.

  • regions.US_WEST (N. California)

  • regions.US_EAST (Ohio)

  • regions.EU_CENTRAL (Frankfurt)

  • regions.AP_SOUTH (Mumbai)

  • regions.AP_NORTHEAST (Seoul)

A region is selected somewhat arbitrarily if you do not specify a region. Always specify a region when deploying or predicting with a free or single-region account.

To deploy your locally trained scikit-learn model, call the deploy method. Provide a name for your model, the Python model object, and the region you would like to deploy to.

Python
from mlrequest import SKLearn
from mlrequest import regions
from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier()
clf.fit(X, y)
sklearn = SKLearn('your-api-key')
sklearn.deploy('rf-classifier', clf, regions.US_EAST)

Depending on the size of your model, it may take a few minutes to be fully deployed.

Deploying Scikit-Learn Models to All Data Centers

If you have a multi-region account, you may deploy your model to all 5 data centers at once to take advantage of latency-routed model predictions.

After your scikit-learn model is trained and evaluated locally, call the deploy method. Provide a name for your model and the Python model object. You do not need to specify the regions, your model will be deployed to all regions by default.

Python
from mlrequest import SKLearn
from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier()
clf.fit(X, y)
sklearn = SKLearn('your-api-key')
sklearn.deploy('rf-classifier', clf)

Your model will then be deployed and duplicated across our 5 data centers. Depending on the size of your model, it may take a few minutes to be fully deployed.