1
0
Форкнуть 0

fix demo - wasn't working before

This commit is contained in:
Ritika Ravichandra 2015-07-14 08:48:33 -07:00
Родитель e0f4e3292b
Коммит cb1b92e3b3
2 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -3,8 +3,8 @@
##################################################################################################### #####################################################################################################
# IMPORTANT: need to compile all of consume, discover, publish functions before running this demo # IMPORTANT: need to compile all of consume, discover, publish functions before running this demo
setwd("C://Users/t-alewa/Documents/Azure-MachineLearning-ClientLibrary-R/demo") # setwd("C://Users/t-alewa/Documents/Azure-MachineLearning-ClientLibrary-R/demo")
#setwd("C://Users/t-ritra/Github/Documents/Azure-MachineLearning-ClientLibrary-R/demo") setwd("C://Users/t-ritra/Documents/Github/Azure-MachineLearning-ClientLibrary-R/demo")
# test server # test server

Просмотреть файл

@ -100,7 +100,7 @@ consumeDataTable <- function(api_key, requestURL, columnNames, ..., globalParam=
#make api call with components of payload #make api call with components of payload
results <- callDTAPI(api_key, requestURL, columnNames, valuesList, globalParam, retryDelay) results <- callDTAPI(api_key, requestURL, columnNames, valuesList, globalParam, retryDelay)
results <- jsonlite::fromJSON(results) results <- jsonlite::fromJSON(results)
resultValues = results$Results$output1$value resultValues = results$Results$output1$value
# Previous lines were commented out, would not return correctly if there were multiple return values # Previous lines were commented out, would not return correctly if there were multiple return values
#resultDF <- data.frame(resultList[,(ncol(resultList))]) #resultDF <- data.frame(resultList[,(ncol(resultList))])
@ -187,15 +187,15 @@ consumeDataframe <- function(api_key, requestURL, valuesDF, globalParam=setNames
resultStored <- jsonlite::fromJSON(temp) resultStored <- jsonlite::fromJSON(temp)
resultList = resultStored$Results$output1$value$Values resultList = resultStored$Results$output1$value$Values
resultDF <- data.frame(resultList[,(ncol(resultList))]) resultDF <- data.frame(resultList[,(ncol(resultList))])
# print(resultDF) # print(resultDF)
# print(is.data.frame(resultDF)) # print(is.data.frame(resultDF))
if(length(df) != 0 && length(resultDF) != 0) { if(length(df) != 0 && length(resultDF) != 0) {
names(df) <- names(resultDF) names(df) <- names(resultDF)
} }
df <- rbind(df,resultDF) df <- rbind(df,resultDF)
colnames(df) <- "Scored probabilities" colnames(df) <- "Scored probabilities"
# print("passed") # print("passed")
print(sprintf("%i %s %i %s", i,"out of",length(values),"processed")) print(sprintf("%i %s %i %s", i,"out of",length(values),"processed"))
valuebatch = list() valuebatch = list()
counter = 0 counter = 0
@ -204,10 +204,10 @@ consumeDataframe <- function(api_key, requestURL, valuesDF, globalParam=setNames
} }
colnames(df) <- "Scored probabilities" colnames(df) <- "Scored probabilities"
return(df) return(df)
# resultStored <- jsonlite::fromJSON(resultStored) # resultStored <- jsonlite::fromJSON(resultStored)
# resultDF <- data.frame(matrix(resultStored$Results$output1$value$Values)) # resultDF <- data.frame(matrix(resultStored$Results$output1$value$Values))
# colnames(resultDF) <- resultStored$Results$output1$value$ColumnNames # colnames(resultDF) <- resultStored$Results$output1$value$ColumnNames
# return(resultDF) # return(resultDF)
} }