Reputation: 57
I built a multiclass SVM model in R and used Create R model module from azure to train and predict my testing dataset. Here are the trainer and the score R scripts.
Trainer R script:
library(e1071)
features <- get.feature.columns(dataset)
labels <- as.factor(get.label.column(dataset))
train.data <- data.frame(features, labels)
feature.names <- get.feature.column.names(dataset)
names(train.data) <- c(feature.names, "Class")
model <- svm(Class ~ . , train.data)
Scores R script:
library(e1071)
classes <- predict(model, dataset)
classes <- as.factor(classes)
res <- data.frame(classes, probabilities = 0.5)
print(str(res))
print(res)
scores <- res
Note in my code, I hardcoded the probability values to simplify the code.
Here is my component design in Azure:
When I run the experiment, all the components work fine. However, in the score model, the scored dataset port does not show the predicted values. It only shows feature values from the testing dataset. I checked the output log of Score model and I could see the model has nicely predicted the testing data (note I added print commands in the Scores R script). But this is not enough and I need the prediction returned from the score model so I can pass it via API.
Has anyone faced this issue before?
Upvotes: 1
Views: 921
Reputation: 57
I found an answer for this. In fact, I cannot see the result in the outcome of the scoring model but when I linked it to a select column in the dataset module, I see the predicted columns there.
Upvotes: 1