2

I've developed a little model in RStudio in a Watson Studio environment in IBM Cloud (https://dataplatform.cloud.ibm.com). I'm trying to save the model in RStudio and deploy it in Watson to publish it as an API, but I'm not finding the way to save it in RStudio.

Is it possible to do what I'm trying to do in the current version?

I've found the following documentation, but I guess it refers to a different version of Watson Studio: https://content-dsxlocal.mybluemix.net/docs/content/SSAS34_current/local-dev/ml-r-models.htm

2 Answers2

0

I couldn't find a way to save the model through Watson Studio functionality. However, I was able to export it in PMML format using the R pmml library and then deploying the PMML as a service.

install.packages("pmml")
library(pmml)
pmml(LogModel, model.name = "Churn_Logistic_Regression_Model", app.name = "Churn_LogReg", description = "Modelo de Regresion para Demo", copyright = NULL, transforms = NULL, unknownValue = NULL, weights = NULL)

Some further documentation: https://www.rdocumentation.org/packages/pmml/versions/1.5.7/topics/pmml.glm

0

Adding to what Gabo has answered with perspective from Watson studio and answering the deploying part of IBM Watson Machine Learning.

  1. what you need to do is first convert the model using pmml

Ex. Run following code in Rstudio on Watson Studio or in R Notebook in Watson Studio.

install.packages("nnet")
library(nnet)
ird <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]),
species = factor(c(rep("s",50), rep("c", 50), rep("v", 50))))
samp <- c(sample(1:50,25), sample(51:100,25), sample(101:150,25))
ir.nn2 <- nnet(species ~ ., data = ird, subset = samp, size = 2, rang = 0.1,
decay = 5e-4, maxit = 200)
install.packages("pmml")
library(pmml)
pmmlmodel <- pmml(ir.nn2)
saveXML(pmmlmodel,file = "IrisNet.xml")
  1. The saveXML() will generate / write IrisNet.xml file to Rstudio or local space of R Notebook, you need to download this file to your local machine.

  2. Now to deploy it to Watson machine learning service, follow following:-

  3. Now Click Add to Project in Watson Studio Project -> Watson Machine Learning Model , Name your model and then select WML service that you want to use

  4. Select From File Tab enter image description here

  5. Drag and drop the xml file

  6. Click Create and it will save it to WML service that you have selected.
  7. Now you can deploy this model to WML service using Deployment tab
  8. Simply name your deployment and Click Save
  9. Now you have deployed model and you can start consuming via REST API.
charles gomes
  • 2,145
  • 10
  • 15