From model fitting to production in seconds

栏目: IT技术 · 发布时间: 5年前

内容简介:Putting ML models in production is a challenge; over 60 percent of modelsAs fitting is not the aim of this tutorial, I will just fit an XGBoost model on the standard(I am ignoring model checking and validation; let’s focus on deployment)

The shortest tutorial I was able to write for deploying ML & AI models efficiently

Putting ML models in production is a challenge; over 60 percent of models never actually make it to production . This need not be the case: putting models into production efficiently can be done using only a few lines of code.

Model fitting

As fitting is not the aim of this tutorial, I will just fit an XGBoost model on the standard scikit-learn breastcancer data :

# Get the data:
from sklearn.datasets import load_breast_cancercancer = load_breast_cancer()X = cancer.data
y = cancer.target# And fit the model:
import xgboost as xgbxgb_model = xgb.XGBClassifier(objective="binary:logistic", random_state=42)
xgb_model.fit(X, y)

(I am ignoring model checking and validation; let’s focus on deployment)

Deploying the model

Now we have the fitted model; let’s deploy it using the sclblpy package :

# Model deployment using the sclblpy package:
import sclblpy as sp# Example feature vector and docs (optional):
fv = X[0, :]  
docs = {}  
docs['name'] = "XGBoost breast cancer model"# The actual deployment: just one line...
sp.upload(xgb_model, fv, docs)

Done.

Using the deployed model

Within seconds after running the code above I received the following email:

From model fitting to production in seconds

Model deployment done.

Clicking the big blue button get’s me to a page where I can directly run inferences:

From model fitting to production in seconds

Generating inferences on the web

While this is nice, you probably want to make a nicer application to use the deployed model. Simply copy-paste code you need for your project:

From model fitting to production in seconds

Simple copy-paste integration of a deployed model into a software project.

And off you go!

Wrap up

There is much more to say about model deployment (and about doing so efficiently: the procedure above actually transpiles your model to WebAssembly to make it efficient and portable), I won’t.

This is just the shortest tutorial I could think of.

Disclaimer

It’s good to note my own involvement here: I am a professor of Data Science at the Jheronimus Academy of Data Science and one of the cofounders of Scailable . Thus, no doubt, I have a vested interest in Scailable; I have an interest in making it grow such that we can finally bring AI to production and deliver on its promises. The opinions expressed here are my own.


以上所述就是小编给大家介绍的《From model fitting to production in seconds》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

产品经理手册(原书第4版)(白金版)

产品经理手册(原书第4版)(白金版)

[美] 琳达·哥乔斯(Linda Gorchels) / 祝亚雄、冯华丽、金骆彬 / 机械工业出版社 / 2017-8 / 65.00

产品经理的职责起点是新产品开发,贯穿产品生命周期的全过程。本书按上下游产品管理进行组织。 在上游的新产品开发流程中,作者阐述了如何从市场、产品、行业、公司的角度规划企划方案,并获得老板、销售部、运营部的资源支持,推进新产品的项目流程,实现所有目标,制定和实施新产品发布。 下游产品的管理核心在于生命周期的管理,营销更是生命周期管理的重中之重。产品经理如何让产品满足客户需求,让客户获得对产......一起来看看 《产品经理手册(原书第4版)(白金版)》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

随机密码生成器
随机密码生成器

多种字符组合密码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具