简体   繁体   English

如何将 R 中的模型部署到 Watson Machine Learning?

[英]How to deploy models in R to Watson Machine Learning?

I have trained an archetypal analysis model using the R library "archetypes" in a Notebook in Watson Studio and I want to deploy it to IBM Cloud Watson Machine Learning and predict the alpha coefficients for new data points using the service.我已经在 Watson Studio 的 Notebook 中使用 R 库“原型”训练了一个原型分析模型,我想将它部署到 IBM Cloud Watson Machine Learning 并使用该服务预测新数据点的 alpha 系数。

I know to do it in python by creating a WML Python Client.我知道通过创建 WML Python 客户端在 python 中完成它。 Is there an equivalent Watson Machine Learning R client?是否有等效的 Watson Machine Learning R 客户端?

#Archetypal analysis example
library("archetypes")
data("skel")
skel2 <- subset(skel, select = -Gender)
set.seed(8376)

train_ind <- sample(seq_len(nrow(skel2)), size = 450)
skel_t <- skel2[train_ind, ]
new_data <- skel2[train_ind, ]

as <- stepArchetypes(skel_t, k=1:12, verbose = FALSE, nrep=5)
a3 <- bestModel(as[[3]]) #select the model with 3 archetypes
alpha_pred <- predict(object = a3, newdata = new_data) #predicted alpha for new data

The easiest way to deploy R models as "model" asset to Watson Machine Learning is by converting them to PMML first.将 R 模型作为“模型”资产部署到 Watson Machine Learning 的最简单方法是首先将它们转换为 PMML。

and here is the list of PMML versions that are supported: https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/pm_service_supported_frameworks.html以下是受支持的 PMML 版本列表: https : //dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/pm_service_supported_frameworks.html

You can see an example of using PMML with python for a model here: https://dataplatform.cloud.ibm.com/exchange/public/entry/view/b3b7b20fa84b8f8e6569064302df339f您可以在此处查看将 PMML 与 python 用于模型的示例: https : //dataplatform.cloud.ibm.com/exchange/public/entry/view/b3b7b20fa84b8f8e6569064302df339f

There are other workarounds within that platform you have, though, like scheduling Notebook "jobs" for your R notebooks.不过,在该平台中还有其他解决方法,例如为 R 笔记本安排笔记本“作业”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM