baarongit / WatsonMachineLearning

SPSS Modeler Extension
Apache License 2.0
0 stars 8 forks source link

Data and model does not match #1

Open Dadle88 opened 7 years ago

Dadle88 commented 7 years ago

When adding this node to SPSS Modeler 18 and running against the Watson Machine Learning service on Bluemix I am not able to get any results returned from the service. Regardless of running against the scoring stream from the exmple in this repository or my own model.

Two things look suspect to me:

  1. the context variable when setting up the node does not seem to change in the console log when dialog option is changed.
  2. X21 variable is hard coded. Should this be dynamic?

The issue from the log below seems to be in the results of the data. results<-append(results,content_list[[1]]$data[[1]][[21]]) Error in content_list[[1]]$data : $ operator is invalid for atomic vectors

Console output: *****R Scripts**** modelerDataModel <- ibmspsscfdatamodel.GetDataModel() modelerData <- ibmspsscfdata.GetDataFromTemp(missingValue=NA,rDate="POSIXct",logicalFields=FALSE)

TODO: Add comment

#

Author: baaron

###############################################################################

modelerData contains the original input data

modelerDataModel contains new data

Install function for packages

packages <- function(x){ x <- as.character(match.call()[[2]]) if (!require(x,character.only=TRUE)){ install.packages(pkgs=x,repos="http://cran.r-project.org") require(x,character.only=TRUE) } } packages(jsonlite) packages(httr) packages(xml2)

modelerData contains the original input data

modelerDataModel contains new data

url <- "https://ibm-watson-ml.mybluemix.net/pm/v1/score/mensSLAMS?accesskey=yRKLh9tacKkYJIQW9jGHcf3TD6sG2zypuz++AkRJZ8XE7rXhgI/90u33DG57oQBmHxGxQ3pIogjgEOjN0TGDTcL0h32gVzPkwMbmHXNpi+FQYUqQmv73SQJrb1WXWeZv"

assemble the content from the original data

base <-"https://palblyp.pmservice.ibmcloud.com/pm/v1/score/" context<-"testStream" token<-"iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog= " url <- paste(base,context ,'?accesskey=',token,sep='')

print(url)

df <- modelerData header <- c() data <- c() results <- c() for(i in 1:nrow(df)){ row<-df[i,] for(i in names(df)){ header<-append(header,i) data<-append(data,toString(row[[i]])) } body = sprintf('{"tablename":"scoreInput","header":%s,"data":[%s]}',toJSON(header),toJSON(data)) r <- POST(url, body = body, encode="json",accept("application/json"),content_type("application/json")) content_list <- content(r) header <- c() data <- c() results<-append(results,content_list[[1]]$data[[1]][[21]]) } results<-data.frame(cbind(results)) modelerData<-cbind(modelerData,results)

print(modelerData)

X21<-c(fieldName="GAME_STYLE_ID",fieldLabel="",fieldStorage="string",fieldFormat="",fieldMeasure="",fieldRole="none") modelerDataModel<-data.frame(modelerDataModel,X21) ibmspsscfdatamodel.SetDataModel(modelerDataModel) ibmspsscfdata.SetDataToTemp(modelerData)


Loading required package: jsonlite Loading required package: httr Loading required package: xml2 Error in content_list[[1]]$data : $ operator is invalid for atomic vectors Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 1650, 0 Error: IBM SPSS CF error: The error code is '1012' With message 'Data and data model does not match.'

watsonml spss stream

watsonml node setup spss stream

watsonml service models

Tmp credentials for the setup: { "url": "https://palblyp.pmservice.ibmcloud.com/pm/v1", "access_key": "iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog=", "username": "4b4f5da2-ed7a-470a-b7a2-6caab793dd66", "password": "db88162f-d898-41fc-8dc4-35cb8fa69bd6" }

baarongit commented 7 years ago

You are right. I am not sure how that was pushed out.

When I am back from vacation, I will fix.

Thanks

On Thu, Apr 13, 2017 at 5:34 AM, Dadle88 notifications@github.com wrote:

When adding this node to SPSS Modeler 18 and running against the Watson Machine Learning service on Bluemix I am not able to get any results returned from the service. Regardless of running against the scoring stream from the exmple in this repository or my own model.

Two things look suspect to me:

  1. the context variable when setting up the node does not seem to change in the console log when dialog option is changed.
  2. X21 variable is hard coded. Should this be dynamic?

The issue from the log below seems to be in the results of the data. results<-append(results,content_list[[1]]$data[[1]][[21]]) Error in content_list[[1]]$data : $ operator is invalid for atomic vectors

Console output: *R Scripts**** modelerDataModel <- ibmspsscfdatamodel.GetDataModel() modelerData <- ibmspsscfdata.GetDataFromTemp(missingValue=NA,rDate=" POSIXct",logicalFields=FALSE) TODO: Add comment Author: baaron

############################################################ ###################

modelerData contains the original input data

modelerDataModel contains new data

Install function for packages

packages <- function(x){ x <- as.character(match.call()[[2]]) if (!require(x,character.only=TRUE)){ install.packages(pkgs=x,repos="http://cran.r-project.org") require(x,character.only=TRUE) } } packages(jsonlite) packages(httr) packages(xml2)

modelerData contains the original input data

modelerDataModel contains new data

url <- "https://ibm-watson-ml.mybluemix.net/pm/v1/score/

mensSLAMS?accesskey=yRKLh9tacKkYJIQW9jGHcf3TD6sG2zypuz++AkRJZ8XE7rXhgI/ 90u33DG57oQBmHxGxQ3pIogjgEOjN0TGDTcL0h32gVzPkwMbmHXNpi+ FQYUqQmv73SQJrb1WXWeZv"

assemble the content from the original data

base <-"https://palblyp.pmservice.ibmcloud.com/pm/v1/score/" context<-"testStream" token<-"iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog= " url <- paste(base,context ,'?accesskey=',token,sep='')

print(url)

df <- modelerData header <- c() data <- c() results <- c() for(i in 1:nrow(df)){ row<-df[i,] for(i in names(df)){ header<-append(header,i) data<-append(data,toString(row[[i]])) } body = sprintf('{"tablename":"scoreInput","header":%s,"data" :[%s]}',toJSON(header),toJSON(data)) r <- POST(url, body = body, encode="json",accept(" application/json"),content_type("application/json")) content_list <- content(r) header <- c() data <- c() results<-append(results,content_list[[1]]$data[[1]][[21]]) } results<-data.frame(cbind(results)) modelerData<-cbind(modelerData,results)

print(modelerData)

X21<-c(fieldName="GAME_STYLE_ID",fieldLabel="",fieldStorage="string", fieldFormat="",fieldMeasure="",fieldRole="none") modelerDataModel<-data.frame(modelerDataModel,X21) ibmspsscfdatamodel.SetDataModel(modelerDataModel) ibmspsscfdata.SetDataToTemp(modelerData)

Loading required package: jsonlite Loading required package: httr Loading required package: xml2 Error in content_list[[1]]$data : $ operator is invalid for atomic vectors Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 1650, 0 Error: IBM SPSS CF error: The error code is '1012' With message 'Data and data model does not match.'

[image: watsonml spss stream] https://cloud.githubusercontent.com/assets/18443351/24999007/376a90e2-203c-11e7-99e6-8e0ae9485c33.png

[image: watsonml node setup spss stream] https://cloud.githubusercontent.com/assets/18443351/24999221/04a3ff76-203d-11e7-8d2c-b76ffa5be47e.png

[image: watsonml service models] https://cloud.githubusercontent.com/assets/18443351/24999122/a76b7ee2-203c-11e7-873c-0517e4c24aa5.JPG

Tmp credentials for the setup: { "url": "https://palblyp.pmservice.ibmcloud.com/pm/v1", "access_key": "iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog=", "username": "4b4f5da2-ed7a-470a-b7a2-6caab793dd66", "password": "db88162f-d898-41fc-8dc4-35cb8fa69bd6" }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/baarongit/WatsonMachineLearning/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AH3Y2isYZqLz-Qmc7_NN4yTt-tKOR332ks5rvewIgaJpZM4M8eBi .

Dadle88 commented 7 years ago

Thanks, looking forward to the update :-) When will you be back from vacation?

Kim Verner Soldal Technical Presale IBM Analytics

Phone: +47 477 58 358 E-mail: kim.soldal@no.ibm.com

From: Aaron Baughman notifications@github.com To: baarongit/WatsonMachineLearning WatsonMachineLearning@noreply.github.com Cc: Kim Verner Soldal/Norway/IBM@IBMNO, Author author@noreply.github.com Date: 14.04.2017 05:50 Subject: Re: [baarongit/WatsonMachineLearning] Data and model does not match (#1)

You are right. I am not sure how that was pushed out.

When I am back from vacation, I will fix.

Thanks

On Thu, Apr 13, 2017 at 5:34 AM, Dadle88 notifications@github.com wrote:

When adding this node to SPSS Modeler 18 and running against the Watson Machine Learning service on Bluemix I am not able to get any results returned from the service. Regardless of running against the scoring stream from the exmple in this repository or my own model.

Two things look suspect to me:

  1. the context variable when setting up the node does not seem to change in the console log when dialog option is changed.
  2. X21 variable is hard coded. Should this be dynamic?

The issue from the log below seems to be in the results of the data. results<-append(results,content_list[[1]]$data[[1]][[21]]) Error in content_list[[1]]$data : $ operator is invalid for atomic vectors

Console output: *R Scripts**** modelerDataModel <- ibmspsscfdatamodel.GetDataModel() modelerData <- ibmspsscfdata.GetDataFromTemp(missingValue=NA,rDate=" POSIXct",logicalFields=FALSE) TODO: Add comment Author: baaron

############################################################ ###################

modelerData contains the original input data

modelerDataModel contains new data

Install function for packages

packages <- function(x){ x <- as.character(match.call()[[2]]) if (!require(x,character.only=TRUE)){ install.packages(pkgs=x,repos="http://cran.r-project.org") require(x,character.only=TRUE) } } packages(jsonlite) packages(httr) packages(xml2)

modelerData contains the original input data

modelerDataModel contains new data

url <- "https://ibm-watson-ml.mybluemix.net/pm/v1/score/

mensSLAMS?accesskey=yRKLh9tacKkYJIQW9jGHcf3TD6sG2zypuz++AkRJZ8XE7rXhgI/ 90u33DG57oQBmHxGxQ3pIogjgEOjN0TGDTcL0h32gVzPkwMbmHXNpi+ FQYUqQmv73SQJrb1WXWeZv"

assemble the content from the original data

base <-"https://palblyp.pmservice.ibmcloud.com/pm/v1/score/" context<-"testStream" token<-"iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog= " url <- paste(base,context ,'?accesskey=',token,sep='')

print(url)

df <- modelerData header <- c() data <- c() results <- c() for(i in 1:nrow(df)){ row<-df[i,] for(i in names(df)){ header<-append(header,i) data<-append(data,toString(row[[i]])) } body = sprintf('{"tablename":"scoreInput","header":%s,"data" :[%s]}',toJSON(header),toJSON(data)) r <- POST(url, body = body, encode="json",accept(" application/json"),content_type("application/json")) content_list <- content(r) header <- c() data <- c() results<-append(results,content_list[[1]]$data[[1]][[21]]) } results<-data.frame(cbind(results)) modelerData<-cbind(modelerData,results)

print(modelerData)

X21<-c(fieldName="GAME_STYLE_ID",fieldLabel="",fieldStorage="string", fieldFormat="",fieldMeasure="",fieldRole="none") modelerDataModel<-data.frame(modelerDataModel,X21) ibmspsscfdatamodel.SetDataModel(modelerDataModel) ibmspsscfdata.SetDataToTemp(modelerData)

Loading required package: jsonlite Loading required package: httr Loading required package: xml2 Error in content_list[[1]]$data : $ operator is invalid for atomic vectors Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 1650, 0 Error: IBM SPSS CF error: The error code is '1012' With message 'Data and data model does not match.'

[image: watsonml spss stream] < https://cloud.githubusercontent.com/assets/18443351/24999007/376a90e2-203c-11e7-99e6-8e0ae9485c33.png

[image: watsonml node setup spss stream] < https://cloud.githubusercontent.com/assets/18443351/24999221/04a3ff76-203d-11e7-8d2c-b76ffa5be47e.png

[image: watsonml service models] < https://cloud.githubusercontent.com/assets/18443351/24999122/a76b7ee2-203c-11e7-873c-0517e4c24aa5.JPG

Tmp credentials for the setup: { "url": "https://palblyp.pmservice.ibmcloud.com/pm/v1", "access_key": "iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog=", "username": "4b4f5da2-ed7a-470a-b7a2-6caab793dd66", "password": "db88162f-d898-41fc-8dc4-35cb8fa69bd6" }

? You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/baarongit/WatsonMachineLearning/issues/1, or mute the thread < https://github.com/notifications/unsubscribe-auth/AH3Y2isYZqLz-Qmc7_NN4yTt-tKOR332ks5rvewIgaJpZM4M8eBi

.

? You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Dersom ikke annet fremkommer ovenfor: / Unless stated otherwise above: International Business Machines AS NO 931 482 580 MVA Foretaksregisteret Rosenholmveien 25, 1414 Trollåsen, Norway

baarongit commented 7 years ago

May 19

Sent from my iPhone

On Apr 14, 2017, at 6:37 PM, Dadle88 notifications@github.com wrote:

Thanks, looking forward to the update :-) When will you be back from vacation?

Kim Verner Soldal Technical Presale IBM Analytics

Phone: +47 477 58 358 E-mail: kim.soldal@no.ibm.com

From: Aaron Baughman notifications@github.com To: baarongit/WatsonMachineLearning WatsonMachineLearning@noreply.github.com Cc: Kim Verner Soldal/Norway/IBM@IBMNO, Author author@noreply.github.com Date: 14.04.2017 05:50 Subject: Re: [baarongit/WatsonMachineLearning] Data and model does not match (#1)

You are right. I am not sure how that was pushed out.

When I am back from vacation, I will fix.

Thanks

On Thu, Apr 13, 2017 at 5:34 AM, Dadle88 notifications@github.com wrote:

When adding this node to SPSS Modeler 18 and running against the Watson Machine Learning service on Bluemix I am not able to get any results returned from the service. Regardless of running against the scoring stream from the exmple in this repository or my own model.

Two things look suspect to me:

  1. the context variable when setting up the node does not seem to change in the console log when dialog option is changed.
  2. X21 variable is hard coded. Should this be dynamic?

The issue from the log below seems to be in the results of the data. results<-append(results,content_list[[1]]$data[[1]][[21]]) Error in content_list[[1]]$data : $ operator is invalid for atomic vectors

Console output: *R Scripts**** modelerDataModel <- ibmspsscfdatamodel.GetDataModel() modelerData <- ibmspsscfdata.GetDataFromTemp(missingValue=NA,rDate=" POSIXct",logicalFields=FALSE) TODO: Add comment Author: baaron

############################################################ ###################

modelerData contains the original input data

modelerDataModel contains new data

Install function for packages

packages <- function(x){ x <- as.character(match.call()[[2]]) if (!require(x,character.only=TRUE)){ install.packages(pkgs=x,repos="http://cran.r-project.org") require(x,character.only=TRUE) } } packages(jsonlite) packages(httr) packages(xml2)

modelerData contains the original input data

modelerDataModel contains new data

url <- "https://ibm-watson-ml.mybluemix.net/pm/v1/score/

mensSLAMS?accesskey=yRKLh9tacKkYJIQW9jGHcf3TD6sG2zypuz++AkRJZ8XE7rXhgI/ 90u33DG57oQBmHxGxQ3pIogjgEOjN0TGDTcL0h32gVzPkwMbmHXNpi+ FQYUqQmv73SQJrb1WXWeZv"

assemble the content from the original data

base <-"https://palblyp.pmservice.ibmcloud.com/pm/v1/score/" context<-"testStream" token<-"iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog= " url <- paste(base,context ,'?accesskey=',token,sep='')

print(url)

df <- modelerData header <- c() data <- c() results <- c() for(i in 1:nrow(df)){ row<-df[i,] for(i in names(df)){ header<-append(header,i) data<-append(data,toString(row[[i]])) } body = sprintf('{"tablename":"scoreInput","header":%s,"data" :[%s]}',toJSON(header),toJSON(data)) r <- POST(url, body = body, encode="json",accept(" application/json"),content_type("application/json")) content_list <- content(r) header <- c() data <- c() results<-append(results,content_list[[1]]$data[[1]][[21]]) } results<-data.frame(cbind(results)) modelerData<-cbind(modelerData,results)

print(modelerData)

X21<-c(fieldName="GAME_STYLE_ID",fieldLabel="",fieldStorage="string", fieldFormat="",fieldMeasure="",fieldRole="none") modelerDataModel<-data.frame(modelerDataModel,X21) ibmspsscfdatamodel.SetDataModel(modelerDataModel) ibmspsscfdata.SetDataToTemp(modelerData)

Loading required package: jsonlite Loading required package: httr Loading required package: xml2 Error in content_list[[1]]$data : $ operator is invalid for atomic vectors Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 1650, 0 Error: IBM SPSS CF error: The error code is '1012' With message 'Data and data model does not match.'

[image: watsonml spss stream] < https://cloud.githubusercontent.com/assets/18443351/24999007/376a90e2-203c-11e7-99e6-8e0ae9485c33.png

[image: watsonml node setup spss stream] < https://cloud.githubusercontent.com/assets/18443351/24999221/04a3ff76-203d-11e7-8d2c-b76ffa5be47e.png

[image: watsonml service models] < https://cloud.githubusercontent.com/assets/18443351/24999122/a76b7ee2-203c-11e7-873c-0517e4c24aa5.JPG

Tmp credentials for the setup: { "url": "https://palblyp.pmservice.ibmcloud.com/pm/v1", "access_key": "iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog=", "username": "4b4f5da2-ed7a-470a-b7a2-6caab793dd66", "password": "db88162f-d898-41fc-8dc4-35cb8fa69bd6" }

? You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/baarongit/WatsonMachineLearning/issues/1, or mute the thread < https://github.com/notifications/unsubscribe-auth/AH3Y2isYZqLz-Qmc7_NN4yTt-tKOR332ks5rvewIgaJpZM4M8eBi

.

? You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Dersom ikke annet fremkommer ovenfor: / Unless stated otherwise above: International Business Machines AS NO 931 482 580 MVA Foretaksregisteret Rosenholmveien 25, 1414 Trollåsen, Norway — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Dadle88 commented 7 years ago

I would need it by may 3rd unfortunately. Will verify that we will use your node, and in that case i can send you the changes.

Kim Verner Soldal Technical Presale IBM Analytics

Phone: +47 477 58 358 E-mail: kim.soldal@no.ibm.com

From: Aaron Baughman notifications@github.com To: baarongit/WatsonMachineLearning WatsonMachineLearning@noreply.github.com Cc: Kim Verner Soldal/Norway/IBM@IBMNO, Author author@noreply.github.com Date: 15.04.2017 01:44 Subject: Re: [baarongit/WatsonMachineLearning] Data and model does not match (#1)

May 19

Sent from my iPhone

On Apr 14, 2017, at 6:37 PM, Dadle88 notifications@github.com wrote:

Thanks, looking forward to the update :-) When will you be back from vacation?

Kim Verner Soldal Technical Presale IBM Analytics

Phone: +47 477 58 358 E-mail: kim.soldal@no.ibm.com

From: Aaron Baughman notifications@github.com To: baarongit/WatsonMachineLearning WatsonMachineLearning@noreply.github.com Cc: Kim Verner Soldal/Norway/IBM@IBMNO, Author author@noreply.github.com Date: 14.04.2017 05:50 Subject: Re: [baarongit/WatsonMachineLearning] Data and model does not match (#1)

You are right. I am not sure how that was pushed out.

When I am back from vacation, I will fix.

Thanks

On Thu, Apr 13, 2017 at 5:34 AM, Dadle88 notifications@github.com wrote:

When adding this node to SPSS Modeler 18 and running against the Watson Machine Learning service on Bluemix I am not able to get any results returned from the service. Regardless of running against the scoring stream from the exmple in this repository or my own model.

Two things look suspect to me:

  1. the context variable when setting up the node does not seem to change in the console log when dialog option is changed.
  2. X21 variable is hard coded. Should this be dynamic?

The issue from the log below seems to be in the results of the data. results<-append(results,content_list[[1]]$data[[1]][[21]]) Error in content_list[[1]]$data : $ operator is invalid for atomic vectors

Console output: *R Scripts**** modelerDataModel <- ibmspsscfdatamodel.GetDataModel() modelerData <- ibmspsscfdata.GetDataFromTemp(missingValue=NA,rDate=" POSIXct",logicalFields=FALSE) TODO: Add comment Author: baaron

############################################################ ###################

modelerData contains the original input data

modelerDataModel contains new data

Install function for packages

packages <- function(x){ x <- as.character(match.call()[[2]]) if (!require(x,character.only=TRUE)){ install.packages(pkgs=x,repos="http://cran.r-project.org") require(x,character.only=TRUE) } } packages(jsonlite) packages(httr) packages(xml2)

modelerData contains the original input data

modelerDataModel contains new data

url <- "https://ibm-watson-ml.mybluemix.net/pm/v1/score/

mensSLAMS?accesskey=yRKLh9tacKkYJIQW9jGHcf3TD6sG2zypuz++AkRJZ8XE7rXhgI/ 90u33DG57oQBmHxGxQ3pIogjgEOjN0TGDTcL0h32gVzPkwMbmHXNpi+ FQYUqQmv73SQJrb1WXWeZv"

assemble the content from the original data

base <-"https://palblyp.pmservice.ibmcloud.com/pm/v1/score/" context<-"testStream" token<-"iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog= " url <- paste(base,context ,'?accesskey=',token,sep='')

print(url)

df <- modelerData header <- c() data <- c() results <- c() for(i in 1:nrow(df)){ row<-df[i,] for(i in names(df)){ header<-append(header,i) data<-append(data,toString(row[[i]])) } body = sprintf('{"tablename":"scoreInput","header":%s,"data" :[%s]}',toJSON(header),toJSON(data)) r <- POST(url, body = body, encode="json",accept(" application/json"),content_type("application/json")) content_list <- content(r) header <- c() data <- c() results<-append(results,content_list[[1]]$data[[1]][[21]]) } results<-data.frame(cbind(results)) modelerData<-cbind(modelerData,results)

print(modelerData)

X21<-c(fieldName="GAME_STYLE_ID",fieldLabel="",fieldStorage="string", fieldFormat="",fieldMeasure="",fieldRole="none") modelerDataModel<-data.frame(modelerDataModel,X21) ibmspsscfdatamodel.SetDataModel(modelerDataModel) ibmspsscfdata.SetDataToTemp(modelerData)

Loading required package: jsonlite Loading required package: httr Loading required package: xml2 Error in content_list[[1]]$data : $ operator is invalid for atomic vectors Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 1650, 0 Error: IBM SPSS CF error: The error code is '1012' With message 'Data and data model does not match.'

[image: watsonml spss stream] <

https://cloud.githubusercontent.com/assets/18443351/24999007/376a90e2-203c-11e7-99e6-8e0ae9485c33.png

[image: watsonml node setup spss stream] <

https://cloud.githubusercontent.com/assets/18443351/24999221/04a3ff76-203d-11e7-8d2c-b76ffa5be47e.png

[image: watsonml service models] <

https://cloud.githubusercontent.com/assets/18443351/24999122/a76b7ee2-203c-11e7-873c-0517e4c24aa5.JPG

Tmp credentials for the setup: { "url": "https://palblyp.pmservice.ibmcloud.com/pm/v1", "access_key": "iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog=", "username": "4b4f5da2-ed7a-470a-b7a2-6caab793dd66", "password": "db88162f-d898-41fc-8dc4-35cb8fa69bd6" }

? You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/baarongit/WatsonMachineLearning/issues/1, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AH3Y2isYZqLz-Qmc7_NN4yTt-tKOR332ks5rvewIgaJpZM4M8eBi

.

? You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Dersom ikke annet fremkommer ovenfor: / Unless stated otherwise above: International Business Machines AS NO 931 482 580 MVA Foretaksregisteret Rosenholmveien 25, 1414 Trollåsen, Norway ? You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

? You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Dersom ikke annet fremkommer ovenfor: / Unless stated otherwise above: International Business Machines AS NO 931 482 580 MVA Foretaksregisteret Rosenholmveien 25, 1414 Trollåsen, Norway

baarongit commented 7 years ago

I pushed up a fix to:

https://github.com/baarongit/WatsonMachineLearning

Please verify this works for you.

I am waiting for IBM to either merge into the SPSS hub code or grant me admin to push into the repo.

Cheers, Aaron

On Sat, Apr 15, 2017 at 5:43 AM, Dadle88 notifications@github.com wrote:

I would need it by may 3rd unfortunately. Will verify that we will use your node, and in that case i can send you the changes.

Kim Verner Soldal Technical Presale IBM Analytics

Phone: +47 477 58 358 <+47%20477%2058%20358> E-mail: kim.soldal@no.ibm.com

From: Aaron Baughman notifications@github.com To: baarongit/WatsonMachineLearning WatsonMachineLearning@noreply.github.com Cc: Kim Verner Soldal/Norway/IBM@IBMNO, Author author@noreply.github.com Date: 15.04.2017 01:44

Subject: Re: [baarongit/WatsonMachineLearning] Data and model does not match (#1)

May 19

Sent from my iPhone

On Apr 14, 2017, at 6:37 PM, Dadle88 notifications@github.com wrote:

Thanks, looking forward to the update :-) When will you be back from vacation?

Kim Verner Soldal Technical Presale IBM Analytics

Phone: +47 477 58 358 <+47%20477%2058%20358> E-mail: kim.soldal@no.ibm.com

From: Aaron Baughman notifications@github.com To: baarongit/WatsonMachineLearning WatsonMachineLearning@noreply.github.com Cc: Kim Verner Soldal/Norway/IBM@IBMNO, Author author@noreply.github.com Date: 14.04.2017 05:50 Subject: Re: [baarongit/WatsonMachineLearning] Data and model does not match (#1)

You are right. I am not sure how that was pushed out.

When I am back from vacation, I will fix.

Thanks

On Thu, Apr 13, 2017 at 5:34 AM, Dadle88 notifications@github.com wrote:

When adding this node to SPSS Modeler 18 and running against the Watson Machine Learning service on Bluemix I am not able to get any results returned from the service. Regardless of running against the scoring stream from the exmple in this repository or my own model.

Two things look suspect to me:

  1. the context variable when setting up the node does not seem to change in the console log when dialog option is changed.
  2. X21 variable is hard coded. Should this be dynamic?

The issue from the log below seems to be in the results of the data. results<-append(results,content_list[[1]]$data[[1]][[21]]) Error in content_list[[1]]$data : $ operator is invalid for atomic vectors

Console output: *R Scripts**** modelerDataModel <- ibmspsscfdatamodel.GetDataModel() modelerData <- ibmspsscfdata.GetDataFromTemp(missingValue=NA,rDate=" POSIXct",logicalFields=FALSE) TODO: Add comment Author: baaron

############################################################ ###################

modelerData contains the original input data

modelerDataModel contains new data

Install function for packages

packages <- function(x){ x <- as.character(match.call()[[2]]) if (!require(x,character.only=TRUE)){ install.packages(pkgs=x,repos="http://cran.r-project.org") require(x,character.only=TRUE) } } packages(jsonlite) packages(httr) packages(xml2)

modelerData contains the original input data

modelerDataModel contains new data

url <- "https://ibm-watson-ml.mybluemix.net/pm/v1/score/

mensSLAMS?accesskey=yRKLh9tacKkYJIQW9jGHcf3TD6sG2zypuz++AkRJZ8XE7rXhgI/ 90u33DG57oQBmHxGxQ3pIogjgEOjN0TGDTcL0h32gVzPkwMbmHXNpi+ FQYUqQmv73SQJrb1WXWeZv"

assemble the content from the original data

base <-"https://palblyp.pmservice.ibmcloud.com/pm/v1/score/" context<-"testStream" token<-"iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog= " url <- paste(base,context ,'?accesskey=',token,sep='')

print(url)

df <- modelerData header <- c() data <- c() results <- c() for(i in 1:nrow(df)){ row<-df[i,] for(i in names(df)){ header<-append(header,i) data<-append(data,toString(row[[i]])) } body = sprintf('{"tablename":"scoreInput","header":%s,"data" :[%s]}',toJSON(header),toJSON(data)) r <- POST(url, body = body, encode="json",accept(" application/json"),content_type("application/json")) content_list <- content(r) header <- c() data <- c() results<-append(results,content_list[[1]]$data[[1]][[21]]) } results<-data.frame(cbind(results)) modelerData<-cbind(modelerData,results)

print(modelerData)

X21<-c(fieldName="GAME_STYLE_ID",fieldLabel="",fieldStorage="string", fieldFormat="",fieldMeasure="",fieldRole="none") modelerDataModel<-data.frame(modelerDataModel,X21) ibmspsscfdatamodel.SetDataModel(modelerDataModel) ibmspsscfdata.SetDataToTemp(modelerData)

Loading required package: jsonlite Loading required package: httr Loading required package: xml2 Error in content_list[[1]]$data : $ operator is invalid for atomic vectors Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 1650, 0 Error: IBM SPSS CF error: The error code is '1012' With message 'Data and data model does not match.'

[image: watsonml spss stream] <

https://cloud.githubusercontent.com/assets/18443351/24999007/376a90e2- 203c-11e7-99e6-8e0ae9485c33.png

[image: watsonml node setup spss stream] <

https://cloud.githubusercontent.com/assets/18443351/24999221/04a3ff76- 203d-11e7-8d2c-b76ffa5be47e.png

[image: watsonml service models] <

https://cloud.githubusercontent.com/assets/18443351/24999122/a76b7ee2- 203c-11e7-873c-0517e4c24aa5.JPG

Tmp credentials for the setup: { "url": "https://palblyp.pmservice.ibmcloud.com/pm/v1", "access_key": "iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog=", "username": "4b4f5da2-ed7a-470a-b7a2-6caab793dd66", "password": "db88162f-d898-41fc-8dc4-35cb8fa69bd6" }

? You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/baarongit/WatsonMachineLearning/issues/1, or mute the thread <

https://github.com/notifications/unsubscribe- auth/AH3Y2isYZqLz-Qmc7_NN4yTt-tKOR332ks5rvewIgaJpZM4M8eBi

.

? You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Dersom ikke annet fremkommer ovenfor: / Unless stated otherwise above: International Business Machines AS NO 931 482 580 MVA Foretaksregisteret Rosenholmveien 25, 1414 Trollåsen, Norway ? You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

? You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Dersom ikke annet fremkommer ovenfor: / Unless stated otherwise above: International Business Machines AS NO 931 482 580 MVA Foretaksregisteret Rosenholmveien 25, 1414 Trollåsen, Norway

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/baarongit/WatsonMachineLearning/issues/1#issuecomment-294283128, or mute the thread https://github.com/notifications/unsubscribe-auth/AH3Y2hPJ3wivbhyE4jX-rO3O9YUtyYDKks5rwJFdgaJpZM4M8eBi .

baarongit commented 7 years ago

Any confirmation yet?

Thanks, Aaron.

On Thu, Apr 13, 2017 at 5:34 AM, Dadle88 notifications@github.com wrote:

When adding this node to SPSS Modeler 18 and running against the Watson Machine Learning service on Bluemix I am not able to get any results returned from the service. Regardless of running against the scoring stream from the exmple in this repository or my own model.

Two things look suspect to me:

  1. the context variable when setting up the node does not seem to change in the console log when dialog option is changed.
  2. X21 variable is hard coded. Should this be dynamic?

The issue from the log below seems to be in the results of the data. results<-append(results,content_list[[1]]$data[[1]][[21]]) Error in content_list[[1]]$data : $ operator is invalid for atomic vectors

Console output: *R Scripts**** modelerDataModel <- ibmspsscfdatamodel.GetDataModel() modelerData <- ibmspsscfdata.GetDataFromTemp(missingValue=NA,rDate=" POSIXct",logicalFields=FALSE) TODO: Add comment Author: baaron

############################################################ ###################

modelerData contains the original input data

modelerDataModel contains new data

Install function for packages

packages <- function(x){ x <- as.character(match.call()[[2]]) if (!require(x,character.only=TRUE)){ install.packages(pkgs=x,repos="http://cran.r-project.org") require(x,character.only=TRUE) } } packages(jsonlite) packages(httr) packages(xml2)

modelerData contains the original input data

modelerDataModel contains new data

url <- "https://ibm-watson-ml.mybluemix.net/pm/v1/score/

mensSLAMS?accesskey=yRKLh9tacKkYJIQW9jGHcf3TD6sG2zypuz++AkRJZ8XE7rXhgI/ 90u33DG57oQBmHxGxQ3pIogjgEOjN0TGDTcL0h32gVzPkwMbmHXNpi+ FQYUqQmv73SQJrb1WXWeZv"

assemble the content from the original data

base <-"https://palblyp.pmservice.ibmcloud.com/pm/v1/score/" context<-"testStream" token<-"iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog= " url <- paste(base,context ,'?accesskey=',token,sep='')

print(url)

df <- modelerData header <- c() data <- c() results <- c() for(i in 1:nrow(df)){ row<-df[i,] for(i in names(df)){ header<-append(header,i) data<-append(data,toString(row[[i]])) } body = sprintf('{"tablename":"scoreInput","header":%s,"data" :[%s]}',toJSON(header),toJSON(data)) r <- POST(url, body = body, encode="json",accept(" application/json"),content_type("application/json")) content_list <- content(r) header <- c() data <- c() results<-append(results,content_list[[1]]$data[[1]][[21]]) } results<-data.frame(cbind(results)) modelerData<-cbind(modelerData,results)

print(modelerData)

X21<-c(fieldName="GAME_STYLE_ID",fieldLabel="",fieldStorage="string", fieldFormat="",fieldMeasure="",fieldRole="none") modelerDataModel<-data.frame(modelerDataModel,X21) ibmspsscfdatamodel.SetDataModel(modelerDataModel) ibmspsscfdata.SetDataToTemp(modelerData)

Loading required package: jsonlite Loading required package: httr Loading required package: xml2 Error in content_list[[1]]$data : $ operator is invalid for atomic vectors Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 1650, 0 Error: IBM SPSS CF error: The error code is '1012' With message 'Data and data model does not match.'

[image: watsonml spss stream] https://cloud.githubusercontent.com/assets/18443351/24999007/376a90e2-203c-11e7-99e6-8e0ae9485c33.png

[image: watsonml node setup spss stream] https://cloud.githubusercontent.com/assets/18443351/24999221/04a3ff76-203d-11e7-8d2c-b76ffa5be47e.png

[image: watsonml service models] https://cloud.githubusercontent.com/assets/18443351/24999122/a76b7ee2-203c-11e7-873c-0517e4c24aa5.JPG

Tmp credentials for the setup: { "url": "https://palblyp.pmservice.ibmcloud.com/pm/v1", "access_key": "iGII4hMmzqA2S1r4EhQfKZohS37Gp+Mg0M5mgtaTZXbxtBkuVEaJWZ+ 7UAsRBycGpvelDBj2EWArRQzCnErs5G6xF7OPG2R5H0oB0w5syog=", "username": "4b4f5da2-ed7a-470a-b7a2-6caab793dd66", "password": "db88162f-d898-41fc-8dc4-35cb8fa69bd6" }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/baarongit/WatsonMachineLearning/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AH3Y2isYZqLz-Qmc7_NN4yTt-tKOR332ks5rvewIgaJpZM4M8eBi .