I have been trying to make use of the ReST query example provided in the Predictive Modeling service API. However, although the following 2 ReST queries seem to work
Retrieving a list of all currently deployed models
Downloading a copy of a specific deployed model file
This one
1. Scoring with a deployed predictive model
throws the following error
"message": "Failed to score Drug1n, msg=ERROR: Missing required input table [scoreInput], details:java.lang.RuntimeException: ERROR: Missing required input table [scoreInput]\n\tat com.ibm.spss.internal.PredictiveScorerCSPImpl$InputIterator.setInputData(PredictiveScorerCSPImpl.java:276)\n\tat com.ibm.spss.internal.PredictiveScorerCSPImpl.score(PredictiveScorerCSPImpl.java:120)\n\tat com.ibm.spss.internal.SynchronizedPredictiveScorerCSPImpl.score(SynchronizedPredictiveScorerCSPImpl.java:68)\n\tat
I have used the exact same POST request (https://ibmpmsrvus2.pmservice.ibmcloud.com:8443/pm/v1/score/Drug1n?accesskey=MASKED=) with the specified JSON request
{
"tablename": "DRUG1n.sav",
"header": [
"Age",
"Sex",
"BP",
"Cholesterol",
"Na",
"K",
"Drug"
],
"data": [
[
43,
"M",
"LOW",
"NORMAL",
0.526102,
0.027164,
"drugY"
]
]
}
as provided in the documentation.
Is the JSON request right? Or is there any other parameter to be entered?
Thanks and Regards
Amit M Mangalvedkar
Answer by JDThorson (141) | Jun 25, 2015 at 07:32 AM
You would not normally pass the 'target' of the prediction in the scoring input so the 'Drug' attribute as passed is not necessary. Please check your 'tablename' to make sure it matches that of the source node on the scoring branch 'marked' in the Modeler stream you have deployed. The error states that the source node (input tablename) is 'scoreInput' and you have specified 'Drug1n.save' in your JSON.
@JDThorson
Thanks a lot for the quick reply. That helped and I was able to get a positive response. I feel that the documentation needs to be slightly modified.
Thanks and Regards
Amit M Mangalvedkar
Answer by JDThorson (141) | Jun 25, 2015 at 08:02 AM
I will check for the typo in the documentation. The tablename should be 'scoreInput' as mentioned in the error returned.
In the NodeJS sample code this is specified as follows, reads close enough to JSON to help...
var input = {
tablename: 'scoreInput',
header: [ 'Age', 'Sex', 'BP', 'Cholesterol', 'Na', 'K' ],
data: [[ p.Age, p.Sex, p.BP, p.Cholesterol, p.Na, p.K ]]
};