Creating Documentation
Documentation for serialize and publish
This commit is contained in:
Родитель
b1b8b5bcf4
Коммит
03654e70e5
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
~%2FGitHub%2FAzure-MachineLearning-ClientLibrary-R%2Fmaml%2FR%2Fconsume.R="4DE8D914"
|
||||
~%2FGitHub%2FAzure-MachineLearning-ClientLibrary-R%2Fmaml%2FR%2Fdiscover.R="340D1402"
|
||||
~%2FGitHub%2FAzure-MachineLearning-ClientLibrary-R%2Fmaml%2FR%2Fpublish.R="27FFA2F0"
|
||||
~%2FGitHub%2FAzure-MachineLearning-ClientLibrary-R%2Fmaml%2FR%2Fserialize.R="9B29E83F"
|
||||
~%2FGitHub%2FAzure-MachineLearning-ClientLibrary-R%2Fmaml%2Fman%2FparamCheck.Rd="8A6742DF"
|
||||
~%2FGitHub%2FAzure-MachineLearning-ClientLibrary-R%2Fmaml%2Fman%2FserializeI.Rd="9F9AFCCB"
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"contents" : "library(rjson)\n\n################################################################\n# Serialization/DeSerialization\n# jsonlite needs to be installed:\n# install.packages(jsonlite)\n################################################################\n\n#Define global variables for serialization\ninputDF <<- data.frame()\noutputDF <<- data.frame()\npublishedFunction <<- getFunctionString\n\n\n\n#' @title Serialize the input\n#' @description Create a serialized dataFrame with the input arguments\n#'\n#' Expecting:\n#' inputSchema = list(\"arg1\"=\"type\", \"arg2\"=\"type\", ...)\n#' @param list Take arguments of a function in type list\n#' @return serialized input expectations\nserializeI <- function(input) {\n #convert input to vectors to be added to dataframe\n inArgs <<- unlist(input)\n inputDF <<- data.frame(inArgs)\n\n #serialize data\n sArgs = jsonlite::serializeJSON(inArgs)\n\n return(sArgs)\n}\n\n\n#' @title Serialize the output\n#' @description Serialize the output DataFrame\n#' Expecting:\n#' outputSchema = list(\"output1\"=\"type\", \"output2\"=\"type\", ...)\n#' @param list Take arguments of a function in type list\n#' @return serialized output expectations\nserializeO <- function(output) {\n #convert output to vectors to be added to dataframe\n outArgs <<- unlist(output)\n outputDF <<- data.frame(outArgs)\n\n #serialize data\n oArgs <- jsonlite::serializeJSON(outArgs)\n return (oArgs)\n}\n\n\n#' @title Serialize the Body of a Function\n#' @description Change function to accept a dataframe\n#' @param string function name to serialize\n#' @return output (fromJSON)\nserializeFunc <- function(publishedFunction) {\n # serialize body of function\n bodyFunction <- body(publishedFunction)\n\n return (jsonlite::serializeJSON(bodyFunction))\n}\n\n\n\n#' @title Serialize (Published) User Arguments\n#' @description Take Output from function and save into output dataframe\n#' Expect arguments from user in a dataframe\n#' @param dataframe Pass dataframe into function\n#' @return serialized output\nserializeMeta <- function(userDF, funcName) {\n # convert back to params\n args <- as.list(userDF[,])\n\n #run function\n output <- do.call(funcName, args)\n print(output)\n returnDF <- data.frame(output)\n\n #serialize output\n oArgs = jsonlite::serializeJSON(returnDF)\n return (oArgs)\n}\n\n\n#' @title Serialize (Published) Output\n#' @description This is an internal funciton\n#' Take Output from function and save into output dataframe\n#' @param dataframe Pass dataframe back to user\n#' @return output dataframe\nunserializeMeta <- function(output) {\n # convert back to params\n outputDF <<- jsonlite::unserializeJSON(output)\n outlist <- as.list(outputDF[,])\n\n print(outlist)\n return (outlist)\n}\n",
|
||||
"created" : 1437517541246.000,
|
||||
"dirty" : false,
|
||||
"encoding" : "UTF-8",
|
||||
"folds" : "",
|
||||
"hash" : "12533593",
|
||||
"id" : "29C3FDC3",
|
||||
"lastKnownWriteTime" : 1437521404,
|
||||
"path" : "~/GitHub/Azure-MachineLearning-ClientLibrary-R/maml/R/serialize.R",
|
||||
"project_path" : "R/serialize.R",
|
||||
"properties" : {
|
||||
},
|
||||
"source_on_save" : false,
|
||||
"type" : "r_source"
|
||||
}
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -12,7 +12,7 @@ wrapper <- "inputDF <- maml.mapInputPort(1)\r\noutputDF <- matrix(ncol = %s, nro
|
|||
# Also consider paste(body(fun())) or getAnywhere()
|
||||
################################################################
|
||||
#' This is a helper function that will convert a function to a string
|
||||
#' @param x - Name of the function to convert to a string
|
||||
#' @param x Name of the function to convert to a string
|
||||
#' @return function in string format
|
||||
getFunctionString <- function (x)
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ getFunctionString <- function (x)
|
|||
##################################################################################
|
||||
#' This is a helper function to extract object and package dependencies
|
||||
# then pack them into a .zip, then a base64 string
|
||||
#' @param functionName - function to package dependencies from
|
||||
#' @param string functionName - function to package dependencies from
|
||||
#' @return encoded zip - will return false if nothing was zipped
|
||||
# TODO: suppress the red text?
|
||||
packDependencies <- function(functionName) {
|
||||
|
@ -152,7 +152,7 @@ packDependencies <- function(functionName) {
|
|||
toPack <- toPack[toPack != pkg]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# if done packing, break
|
||||
if (length(toPack) == 0) {
|
||||
break
|
||||
|
@ -164,19 +164,19 @@ packDependencies <- function(functionName) {
|
|||
}
|
||||
# go back to where the user started
|
||||
setwd(start)
|
||||
|
||||
|
||||
# objects, functions, etc.
|
||||
if (length(dependencies) > 0) {
|
||||
# maybe can save directly as a .zip and skip the zip() call?
|
||||
save(dependencies, file=guid)
|
||||
toZip <- c(toZip, guid)
|
||||
}
|
||||
|
||||
|
||||
# zip up everything
|
||||
if (length(toZip) > 0) {
|
||||
zip(zipfile=guid, files=toZip)
|
||||
zipEnc <- base64enc::base64encode(paste(guid, ".zip", sep=""))
|
||||
|
||||
|
||||
# delete the packages
|
||||
for (pkg in packages) {
|
||||
# did I miss anything? maybe extra files floating around
|
||||
|
@ -185,7 +185,7 @@ packDependencies <- function(functionName) {
|
|||
# delete the dependency rdta file
|
||||
file.remove(guid)
|
||||
file.remove(paste(guid,"zip",sep="."))
|
||||
|
||||
|
||||
# return the encoded zip as a string
|
||||
return(list(guid, zipEnc))
|
||||
}
|
||||
|
@ -201,9 +201,9 @@ packDependencies <- function(functionName) {
|
|||
# Similar structure to packDependencies()
|
||||
##################################################################################
|
||||
#' This is helper function to recursively gather dependencies from user defined-functions
|
||||
#' @param functionName - Name of function to recursively gather dependencies from
|
||||
#' @param dependencies - List of package dependencies
|
||||
#' @param packages - Name of available packages
|
||||
#' @param string functionName - Name of function to recursively gather dependencies from
|
||||
#' @param list dependencies - List of package dependencies
|
||||
#' @param list packages - Name of available packages
|
||||
#' @return list of packages and dependencies
|
||||
recurDep <- function(functionName, dependencies, packages) {
|
||||
for (obj in codetools::findGlobals(get(functionName))) {
|
||||
|
@ -232,8 +232,8 @@ recurDep <- function(functionName, dependencies, packages) {
|
|||
# Helper function to recursively gather dependencies from user defined-functions
|
||||
##################################################################################
|
||||
#' This is helper function to recursively gather dependencies from user defined-functions
|
||||
#' @param pkgName - Name of package to check for existence in list of packages
|
||||
#' @param packages - Name of available packages
|
||||
#' @param string pkgName - Name of package to check for existence in list of packages
|
||||
#' @param list packages - Name of available packages
|
||||
#' @return list of packages
|
||||
recurPkg <- function(pkgName, packages) {
|
||||
# if the package isn't already in the list
|
||||
|
@ -242,7 +242,7 @@ recurPkg <- function(pkgName, packages) {
|
|||
packages <- c(pkgName, packages)
|
||||
pkgDeps <- available.packages()
|
||||
|
||||
# if the package is available on a repo
|
||||
# if the package is available on a repo
|
||||
if (pkgName %in% row.names(available.packages())) {
|
||||
# iterate through the dependencies and check if need to add them
|
||||
for (pkg in strsplit(available.packages()[pkgName, "Depends"], split=", ")[[1]]) {
|
||||
|
@ -262,7 +262,7 @@ recurPkg <- function(pkgName, packages) {
|
|||
}
|
||||
}
|
||||
}
|
||||
# return updated list of packages
|
||||
# return updated list of packages
|
||||
return(packages)
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ recurPkg <- function(pkgName, packages) {
|
|||
# Helper function to convert expected schema to API-expecting format
|
||||
################################################################
|
||||
#' This is a helper function to convert expected schema to API-expecting format
|
||||
#' @param argList - List of expected input parameters
|
||||
#' @param list argList - List of expected input parameters
|
||||
#' @return Converted inputSchema to the proper format
|
||||
convert <- function(argList) {
|
||||
form <- list()
|
||||
|
@ -308,8 +308,8 @@ convert <- function(argList) {
|
|||
# This is a helper function to ensure that the inputSchema has recieved all of the expected parameters
|
||||
################################################################
|
||||
#' This is a helper function to check that the user has passed in all of the expected parameters.
|
||||
#' @param userInput - List of expected input parameters
|
||||
#' @param funcName - The function that is being published
|
||||
#' @param list userInput - List of expected input parameters
|
||||
#' @param string funcName - The function that is being published
|
||||
#' @return False if the input was not as expected/True if input matched expectation
|
||||
paramCheck <- function(userInput, funcName) {
|
||||
numParamsEXPECTED <- length(formals(funcName))
|
||||
|
@ -332,17 +332,18 @@ paramCheck <- function(userInput, funcName) {
|
|||
# expecting outputSchema = list("output1"="type", "output2"="type", ...)
|
||||
# functionName is a string!!
|
||||
################################################################
|
||||
# TODO: play around with argument order
|
||||
#' This function publishes code given a valid workspace ID and authentication token. The function expects the function name, service name, and
|
||||
|
||||
#' @title Publish Web Service
|
||||
#' @description This function publishes code given a valid workspace ID and authentication token. The function expects the function name, service name, and
|
||||
#' the input and output schemas from the user.
|
||||
#' The user can expect a list of the web service details, the default endpoint details and the consumption function and use this information to access
|
||||
#' the published function.
|
||||
#' @param functionName - The function that is being published
|
||||
#' @param serviceName - The name they would like the function published under
|
||||
#' @param inputSchema - List of expected input parameters
|
||||
#' @param outputSchema - List of expected output
|
||||
#' @param wkID - The workspace ID
|
||||
#' @param authToken - The primary authorization token
|
||||
#' @param string functionName - The function that is being published
|
||||
#' @param string serviceName - The name they would like the function published under
|
||||
#' @param list inputSchema - List of expected input parameters
|
||||
#' @param list outputSchema - List of expected output
|
||||
#' @param string wkID - The workspace ID
|
||||
#' @param string authToken - The primary authorization token
|
||||
#' @return List of webservice details, default endpoint details, and the consumption function
|
||||
publishWebService <- function(functionName, serviceName, inputSchema, outputSchema, wkID, authToken) {
|
||||
|
||||
|
|
|
@ -12,23 +12,13 @@ outputDF <<- data.frame()
|
|||
publishedFunction <<- getFunctionString
|
||||
|
||||
|
||||
#' \name{Serialization}
|
||||
#' \title{Serialize Input}
|
||||
#' \description{
|
||||
#' serializeI stores the expected input parameters into a dataframe and then serializes the dataframe
|
||||
#' }
|
||||
#' \usage{serializeI(x)}
|
||||
#' \arguments{
|
||||
#' \item{x}{input schema
|
||||
#' inputSchema = list("arg1"="type", "arg2"="type", ...)}
|
||||
#' }
|
||||
#' \value {The serialized input paramaters.}
|
||||
|
||||
#' @title Serialize the input
|
||||
#' @description Create a serialized dataFrame with the input arguments
|
||||
#'
|
||||
#' Create a DataFrame with these arguments
|
||||
#' ***Need to make dataframe global***
|
||||
#' Expecting:
|
||||
#' inputSchema = list("arg1"="type", "arg2"="type", ...)
|
||||
#' @param Take arguments of a function in type list
|
||||
#' @param list Take arguments of a function in type list
|
||||
#' @return serialized input expectations
|
||||
serializeI <- function(input) {
|
||||
#convert input to vectors to be added to dataframe
|
||||
|
@ -41,23 +31,12 @@ serializeI <- function(input) {
|
|||
return(sArgs)
|
||||
}
|
||||
|
||||
#' \name{Serialization}
|
||||
#' \title{Serialize Output}
|
||||
#' \description{
|
||||
#' serializeI stores the expected output parameters into a dataframe and then serializes the dataframe
|
||||
#' }
|
||||
#' \usage{serializeO(x)}
|
||||
#' \arguments{
|
||||
#' \item{x}{output schema
|
||||
#' outputSchema = list("arg1"="type", "arg2"="type", ...)}
|
||||
#' }
|
||||
#' \value {The serialized output paramaters.}
|
||||
#'
|
||||
#' Create a DataFrame with these arguments
|
||||
#' ***Need to make dataframe global***
|
||||
|
||||
#' @title Serialize the output
|
||||
#' @description Serialize the output DataFrame
|
||||
#' Expecting:
|
||||
#' outputSchema = list("output1"="type", "output2"="type", ...)
|
||||
#' @param Take arguments of a function in type list
|
||||
#' @param list Take arguments of a function in type list
|
||||
#' @return serialized output expectations
|
||||
serializeO <- function(output) {
|
||||
#convert output to vectors to be added to dataframe
|
||||
|
@ -69,21 +48,10 @@ serializeO <- function(output) {
|
|||
return (oArgs)
|
||||
}
|
||||
|
||||
#' \name{Serialization}
|
||||
#' \title{Serialize Function}
|
||||
#' \description{
|
||||
#' serializeI stores the expected output parameters into a dataframe and then serializes the dataframe
|
||||
#' }
|
||||
#' \usage{serializeO(x)}
|
||||
#' \arguments{
|
||||
#' \item{x}{output schema
|
||||
#' outputSchema = list("arg1"="type", "arg2"="type", ...)}
|
||||
#' }
|
||||
#' \value {The serialized function body}
|
||||
#'
|
||||
#' Serialized Body of Function
|
||||
#' Change function to accept a dataframe
|
||||
#' @param function
|
||||
|
||||
#' @title Serialize the Body of a Function
|
||||
#' @description Change function to accept a dataframe
|
||||
#' @param string function name to serialize
|
||||
#' @return output (fromJSON)
|
||||
serializeFunc <- function(publishedFunction) {
|
||||
# serialize body of function
|
||||
|
@ -92,21 +60,12 @@ serializeFunc <- function(publishedFunction) {
|
|||
return (jsonlite::serializeJSON(bodyFunction))
|
||||
}
|
||||
|
||||
#' \name{Serialization}
|
||||
#' \title{Serialize MetaData}
|
||||
#' \description{
|
||||
#' serializeMeta runs the serialized/published function on an internal level
|
||||
#' }
|
||||
#' \usage{serializeMeta(df, functionName)}
|
||||
#' \arguments{
|
||||
#' \item{df}{Dataframe containing input parameters}
|
||||
#' \item{functionName}{Name of the published function to run}
|
||||
#' }
|
||||
#' \value {The serialized ouput}
|
||||
#'
|
||||
#' Serialize (Published) User Arguments: Expect arguments from user in a dataframe
|
||||
#' Take Output from function and save into output dataframe
|
||||
#' @param Pass dataframe into function
|
||||
|
||||
|
||||
#' @title Serialize (Published) User Arguments
|
||||
#' @description Take Output from function and save into output dataframe
|
||||
#' Expect arguments from user in a dataframe
|
||||
#' @param dataframe Pass dataframe into function
|
||||
#' @return serialized output
|
||||
serializeMeta <- function(userDF, funcName) {
|
||||
# convert back to params
|
||||
|
@ -122,20 +81,11 @@ serializeMeta <- function(userDF, funcName) {
|
|||
return (oArgs)
|
||||
}
|
||||
|
||||
#' \name{Serialization}
|
||||
#' \title{UnSerialize MetaData}
|
||||
#' \description{
|
||||
#' serializeMeta converts the serialized output back to readable data for the user
|
||||
#' }
|
||||
#' \usage{unserializeMeta(output)}
|
||||
#' \arguments{
|
||||
#' \item{output}{The output from the function run}
|
||||
#' }
|
||||
#' \value {The unserialized ouput}
|
||||
#'
|
||||
#' Serialize (Published) Output: This is an internal funciton
|
||||
|
||||
#' @title Serialize (Published) Output
|
||||
#' @description This is an internal funciton
|
||||
#' Take Output from function and save into output dataframe
|
||||
#' @param Pass dataframe back to user
|
||||
#' @param dataframe Pass dataframe back to user
|
||||
#' @return output dataframe
|
||||
unserializeMeta <- function(output) {
|
||||
# convert back to params
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/consume.R
|
||||
\name{callAPI}
|
||||
\alias{callAPI}
|
||||
\title{This function is a helper that takes in an API key, values in the key value format and column names to pass to the API and the request URL (OData Endpoint Address).
|
||||
It then obtains a response from Azure Machine Learning Studio and returns a response to the consumeFile function.}
|
||||
\usage{
|
||||
callAPI(api_key, requestURL, keyvalues, globalParam, retryDelay)
|
||||
}
|
||||
\description{
|
||||
This function is a helper that takes in an API key, values in the key value format and column names to pass to the API and the request URL (OData Endpoint Address).
|
||||
It then obtains a response from Azure Machine Learning Studio and returns a response to the consumeFile function.
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/consume.R
|
||||
\name{callDTAPI}
|
||||
\alias{callDTAPI}
|
||||
\title{This function is a helper that takes in an API key, values in the data table format and column names to pass to the API and the request URL (OData Endpoint Address).
|
||||
It then obtains a response from Azure Machine Learning Studio and returns a response to the consumeFile function.}
|
||||
\usage{
|
||||
callDTAPI(api_key, requestURL, columnNames, values, globalParam, retryDelay)
|
||||
}
|
||||
\description{
|
||||
This function is a helper that takes in an API key, values in the data table format and column names to pass to the API and the request URL (OData Endpoint Address).
|
||||
It then obtains a response from Azure Machine Learning Studio and returns a response to the consumeFile function.
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/consume.R
|
||||
\name{consumeDataTable}
|
||||
\alias{consumeDataTable}
|
||||
\title{This function takes in an API key, the request URL (OData Endpoint Address), the column names and multiple requests
|
||||
It scores the experiment with the requests stored in a list of lists, and sends it to the server in the appropriate format.
|
||||
It then obtains a response from Azure Machine Learning Studio and returns a response to the user. It returns the output column(s) along with the scored probablities!}
|
||||
\usage{
|
||||
consumeDataTable(api_key, requestURL, columnNames, ..., globalParam = "",
|
||||
retryDelay = 0.3)
|
||||
}
|
||||
\arguments{
|
||||
\item{requestURL}{must be entered as the third parameter, and must be a string}
|
||||
|
||||
\item{columnNames}{entered as a list}
|
||||
|
||||
\item{...}{each parameter must be a request in the format of a list that contains a row of values corresponsing to the column names provided}
|
||||
|
||||
\item{globalParam}{global parameters entered as a string, default value is ""}
|
||||
|
||||
\item{retryDelay}{the time in seconds to delay before retrying in case of a server error, default value of 0.3 seconds}
|
||||
|
||||
\item{api}{key must be entered as the first parameter, and must be a string}
|
||||
}
|
||||
\value{
|
||||
results in a list of lists, with the scored probability at the end of each list
|
||||
}
|
||||
\description{
|
||||
This function takes in an API key, the request URL (OData Endpoint Address), the column names and multiple requests
|
||||
It scores the experiment with the requests stored in a list of lists, and sends it to the server in the appropriate format.
|
||||
It then obtains a response from Azure Machine Learning Studio and returns a response to the user. It returns the output column(s) along with the scored probablities!
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/consume.R
|
||||
\name{consumeDataframe}
|
||||
\alias{consumeDataframe}
|
||||
\title{This function takes in an API key, the request URL (OData Endpoint Address), the column names and multiple requests
|
||||
It scores the experiment with the requests stored in a list of lists, and sends it to the server in the appropriate format.
|
||||
It then obtains a response from Azure Machine Learning Studio and returns a response to the user. It returns the output column(s) along with the scored probablities!}
|
||||
\usage{
|
||||
consumeDataframe(api_key, requestURL, valuesDF, globalParam = setNames(list(),
|
||||
character(0)), batchSize = 250, retryDelay = 0.3)
|
||||
}
|
||||
\arguments{
|
||||
\item{requestURL}{must be entered as the third parameter, and must be a string}
|
||||
|
||||
\item{valuesDF}{the name of the data frame that is being scored}
|
||||
|
||||
\item{globalParam}{global parameters entered as a string, default value is ""}
|
||||
|
||||
\item{batchSize}{of each batch, which is optional, but 100 by default}
|
||||
|
||||
\item{retryDelay}{the time in seconds to delay before retrying in case of a server error, default value of 0.3 seconds}
|
||||
|
||||
\item{api}{key must be entered as the first parameter, and must be a string}
|
||||
}
|
||||
\value{
|
||||
results in a list of lists, with the scored probability at the end of each list
|
||||
}
|
||||
\description{
|
||||
This function takes in an API key, the request URL (OData Endpoint Address), the column names and multiple requests
|
||||
It scores the experiment with the requests stored in a list of lists, and sends it to the server in the appropriate format.
|
||||
It then obtains a response from Azure Machine Learning Studio and returns a response to the user. It returns the output column(s) along with the scored probablities!
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/consume.R
|
||||
\name{consumeFile}
|
||||
\alias{consumeFile}
|
||||
\title{This function takes in an API key, file name and the request URL (OData Endpoint Address).
|
||||
It calls a helper function that sends requests to the server to the server in the appropriate format.
|
||||
It processes requests in batches and stores the responses in order of batches in an array. It returns the output columns along with the scored probablities, and stores the result in a text file.}
|
||||
\usage{
|
||||
consumeFile(api_key, requestURL, infileName, globalParam = setNames(list(),
|
||||
character(0)), outfileName = "results.csv", batchSize = 250,
|
||||
retryDelay = 0.3)
|
||||
}
|
||||
\arguments{
|
||||
\item{requestURL}{must be entered as the third parameter, and must be a string}
|
||||
|
||||
\item{infileName}{the name of the file that is being scored}
|
||||
|
||||
\item{globalParam}{global parameters entered as a string, default value is ""}
|
||||
|
||||
\item{outfileName}{the name of the file to write results to, entered as a string, with a default value of "results.txt"}
|
||||
|
||||
\item{batchSize}{of each batch, which is optional, but 100 by default}
|
||||
|
||||
\item{retryDelay}{the time in seconds to delay before retrying in case of a server error, default value of 0.3 seconds}
|
||||
|
||||
\item{api}{key must be entered as the first parameter, and must be a string}
|
||||
}
|
||||
\value{
|
||||
results in a list of lists, with the scored probability at the end of each list
|
||||
}
|
||||
\description{
|
||||
This function takes in an API key, file name and the request URL (OData Endpoint Address).
|
||||
It calls a helper function that sends requests to the server to the server in the appropriate format.
|
||||
It processes requests in batches and stores the responses in order of batches in an array. It returns the output columns along with the scored probablities, and stores the result in a text file.
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/consume.R
|
||||
\name{consumeLists}
|
||||
\alias{consumeLists}
|
||||
\title{This function takes in an API key, the request URL (OData Endpoint Address), the column names and multiple requests
|
||||
It scores the experiment with the requests stored in a list of lists, and sends it to the server in the appropriate format.
|
||||
It then obtains a response from Azure Machine Learning Studio and returns a response to the user. It returns the output column(s) along with the scored probablities!}
|
||||
\usage{
|
||||
consumeLists(api_key, requestURL, ..., globalParam = setNames(list(),
|
||||
character(0)), retryDelay = 0.3)
|
||||
}
|
||||
\arguments{
|
||||
\item{requestURL}{must be entered as the third parameter, and must be a string}
|
||||
|
||||
\item{...}{each parameter must be a request in the format of a list that contains a row of values corresponding to the column names provided}
|
||||
|
||||
\item{globalParam}{global parameters entered as a string, default value is ""}
|
||||
|
||||
\item{retryDelay}{the time in seconds to delay before retrying in case of a server error, default value of 0.3 seconds}
|
||||
|
||||
\item{api}{key must be entered as the first parameter, and must be a string}
|
||||
|
||||
\item{columnNames}{entered as a list}
|
||||
}
|
||||
\value{
|
||||
results in a list of lists, with the scored probability at the end of each list
|
||||
}
|
||||
\description{
|
||||
This function takes in an API key, the request URL (OData Endpoint Address), the column names and multiple requests
|
||||
It scores the experiment with the requests stored in a list of lists, and sends it to the server in the appropriate format.
|
||||
It then obtains a response from Azure Machine Learning Studio and returns a response to the user. It returns the output column(s) along with the scored probablities!
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/publish.R
|
||||
\name{convert}
|
||||
\alias{convert}
|
||||
\title{This is a helper function to convert expected schema to API-expecting format}
|
||||
\usage{
|
||||
convert(argList)
|
||||
}
|
||||
\arguments{
|
||||
\item{list}{argList - List of expected input parameters}
|
||||
}
|
||||
\value{
|
||||
Converted inputSchema to the proper format
|
||||
}
|
||||
\description{
|
||||
This is a helper function to convert expected schema to API-expecting format
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
\alias{getEPDetails}
|
||||
\title{Get the details on a specific endpoint}
|
||||
\usage{
|
||||
getEPDetails(wkID, authToken, wsID, epID)
|
||||
getEPDetails(wkID, authToken, wsID, epID, url = epURLdet)
|
||||
}
|
||||
\arguments{
|
||||
\item{wkID}{The workspace ID}
|
||||
|
@ -25,6 +25,7 @@ Returns a named list representing the endpoint with the following fields:
|
|||
Get the details on a specific endpoint
|
||||
}
|
||||
\examples{
|
||||
DELETE TOKENS IN REAL VERSION
|
||||
defaultEP = getEPDetails("c01fb89129aa4ef0a19affa7f95ecbbc", "523709d06661441bbf129d68f84cd6a4", "6a46d1f2a5e6406b8b1a5c563bf1cd10", "default")
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
\alias{getEndpoints}
|
||||
\title{Get the endpoints that are part of a web service}
|
||||
\usage{
|
||||
getEndpoints(wkID, authToken, wsID)
|
||||
getEndpoints(wkID, authToken, wsID, url = epURL)
|
||||
}
|
||||
\arguments{
|
||||
\item{wkID}{The workspace ID}
|
||||
|
@ -24,6 +24,7 @@ as a nested named list with the following fields:
|
|||
Get the endpoints that are part of a web service
|
||||
}
|
||||
\examples{
|
||||
DELETE TOKENS IN REAL VERSION
|
||||
endpoints = getEndpoints("c01fb89129aa4ef0a19affa7f95ecbbc", "523709d06661441bbf129d68f84cd6a4", "6a46d1f2a5e6406b8b1a5c563bf1cd10")
|
||||
defaultEP = endpoints[[1]]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/publish.R
|
||||
\name{getFunctionString}
|
||||
\alias{getFunctionString}
|
||||
\title{This is a helper function that will convert a function to a string}
|
||||
\usage{
|
||||
getFunctionString(x)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{Name of the function to convert to a string}
|
||||
}
|
||||
\value{
|
||||
function in string format
|
||||
}
|
||||
\description{
|
||||
This is a helper function that will convert a function to a string
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
\alias{getWSDetails}
|
||||
\title{Get detailed information about a specific webservice}
|
||||
\usage{
|
||||
getWSDetails(wkID, authToken, wsID)
|
||||
getWSDetails(wkID, authToken, wsID, url = wsURLdet)
|
||||
}
|
||||
\arguments{
|
||||
\item{wkID}{The workspace ID}
|
||||
|
@ -22,6 +22,7 @@ with the following fields:
|
|||
Get detailed information about a specific webservice
|
||||
}
|
||||
\examples{
|
||||
DELETE TOKENS IN REAL VERSION
|
||||
service = getWSDetails("c01fb89129aa4ef0a19affa7f95ecbbc", "523709d06661441bbf129d68f84cd6a4", "6a46d1f2a5e6406b8b1a5c563bf1cd10")
|
||||
serviceID = service["Id"]
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
\alias{getWebServices}
|
||||
\title{Get a list of webservices available to a workspace}
|
||||
\usage{
|
||||
getWebServices(wkID, authToken)
|
||||
getWebServices(wkID, authToken, url = wsURL)
|
||||
}
|
||||
\arguments{
|
||||
\item{wkID}{The workspace ID}
|
||||
|
@ -20,6 +20,7 @@ as a nested named list with the following fields:
|
|||
Get a list of webservices available to a workspace
|
||||
}
|
||||
\examples{
|
||||
DELETE TOKENS IN REAL VERSION
|
||||
services = getWebServices("c01fb89129aa4ef0a19affa7f95ecbbc", "523709d06661441bbf129d68f84cd6a4")
|
||||
serviceID = services[[1]]["Id"]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/publish.R
|
||||
\name{packDependencies}
|
||||
\alias{packDependencies}
|
||||
\title{This is a helper function to extract object and package dependencies}
|
||||
\usage{
|
||||
packDependencies(functionName)
|
||||
}
|
||||
\arguments{
|
||||
\item{string}{functionName - function to package dependencies from}
|
||||
}
|
||||
\value{
|
||||
encoded zip - will return false if nothing was zipped
|
||||
}
|
||||
\description{
|
||||
This is a helper function to extract object and package dependencies
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/publish.R
|
||||
\name{paramCheck}
|
||||
\alias{paramCheck}
|
||||
\title{This is a helper function to check that the user has passed in all of the expected parameters.}
|
||||
\usage{
|
||||
paramCheck(userInput, funcName)
|
||||
}
|
||||
\arguments{
|
||||
\item{list}{userInput - List of expected input parameters}
|
||||
|
||||
\item{string}{funcName - The function that is being published}
|
||||
}
|
||||
\value{
|
||||
False if the input was not as expected/True if input matched expectation
|
||||
}
|
||||
\description{
|
||||
This is a helper function to check that the user has passed in all of the expected parameters.
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/consume.R
|
||||
\name{predictService}
|
||||
\alias{predictService}
|
||||
\title{Make a call to an API with arguments}
|
||||
\usage{
|
||||
predictService(serviceUrl = defaultUrl, key = defaultKey,
|
||||
toScore = defaultParams)
|
||||
}
|
||||
\arguments{
|
||||
\item{serviceUrl}{The url of the web app}
|
||||
|
||||
\item{key}{The API key}
|
||||
|
||||
\item{toScore}{the parameters}
|
||||
}
|
||||
\value{
|
||||
The call to the web service at \code{serviceUrl} with arguments \code{toScore}
|
||||
}
|
||||
\description{
|
||||
Make a call to an API with arguments
|
||||
}
|
||||
\examples{
|
||||
nKey = "JlSp5W+RWf2boTHLwvOvW32j/dDI8d/+ghCb8HTZHKYBl+QkZE46w+ZAxTAdo6U1lXfR6G2SBgnK3/i3VznSww=="
|
||||
nUrl = "https://ussouthcentral.services.azureml.net/workspaces/c01fb89129aa4ef0a19affa7f95ecbbc/services/dadb2d2e626b4e06981dfc6b2b960ebb/execute?api-version=2.0&details=true"
|
||||
nParams = list(
|
||||
Inputs = list(
|
||||
"input1" = list(
|
||||
"ColumnNames" = list("Column 0", "Class", "Sex", "Age", "Freq"),
|
||||
"Values" = list( list( "0", "value", "value", "value", "0" ), list( "0", "value", "value", "value", "0" ) )
|
||||
) ),
|
||||
GlobalParameters = fromJSON('{}')
|
||||
)
|
||||
predictService(url, key, params)
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/publish.R
|
||||
\name{publishWebService}
|
||||
\alias{publishWebService}
|
||||
\title{Publish Web Service}
|
||||
\usage{
|
||||
publishWebService(functionName, serviceName, inputSchema, outputSchema, wkID,
|
||||
authToken)
|
||||
}
|
||||
\arguments{
|
||||
\item{string}{functionName - The function that is being published}
|
||||
|
||||
\item{string}{serviceName - The name they would like the function published under}
|
||||
|
||||
\item{list}{inputSchema - List of expected input parameters}
|
||||
|
||||
\item{list}{outputSchema - List of expected output}
|
||||
|
||||
\item{string}{wkID - The workspace ID}
|
||||
|
||||
\item{string}{authToken - The primary authorization token}
|
||||
}
|
||||
\value{
|
||||
List of webservice details, default endpoint details, and the consumption function
|
||||
}
|
||||
\description{
|
||||
This function publishes code given a valid workspace ID and authentication token. The function expects the function name, service name, and
|
||||
the input and output schemas from the user.
|
||||
The user can expect a list of the web service details, the default endpoint details and the consumption function and use this information to access
|
||||
the published function.
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/publish.R
|
||||
\name{publishWebServiceOld}
|
||||
\alias{publishWebServiceOld}
|
||||
\title{Publish a model to Microsoft Azure}
|
||||
\usage{
|
||||
publishWebServiceOld(functionName)
|
||||
}
|
||||
\arguments{
|
||||
\item{functionName}{The function to be published}
|
||||
}
|
||||
\value{
|
||||
The response from the server, including URL and API key
|
||||
}
|
||||
\description{
|
||||
Publish a model to Microsoft Azure
|
||||
}
|
||||
\examples{
|
||||
publishWebService(myFunction
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/publish.R
|
||||
\name{recurDep}
|
||||
\alias{recurDep}
|
||||
\title{This is helper function to recursively gather dependencies from user defined-functions}
|
||||
\usage{
|
||||
recurDep(functionName, dependencies, packages)
|
||||
}
|
||||
\arguments{
|
||||
\item{string}{functionName - Name of function to recursively gather dependencies from}
|
||||
|
||||
\item{list}{dependencies - List of package dependencies}
|
||||
|
||||
\item{list}{packages - Name of available packages}
|
||||
}
|
||||
\value{
|
||||
list of packages and dependencies
|
||||
}
|
||||
\description{
|
||||
This is helper function to recursively gather dependencies from user defined-functions
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/publish.R
|
||||
\name{recurPkg}
|
||||
\alias{recurPkg}
|
||||
\title{This is helper function to recursively gather dependencies from user defined-functions}
|
||||
\usage{
|
||||
recurPkg(pkgName, packages)
|
||||
}
|
||||
\arguments{
|
||||
\item{string}{pkgName - Name of package to check for existence in list of packages}
|
||||
|
||||
\item{list}{packages - Name of available packages}
|
||||
}
|
||||
\value{
|
||||
list of packages
|
||||
}
|
||||
\description{
|
||||
This is helper function to recursively gather dependencies from user defined-functions
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/serialize.R
|
||||
\name{serializeFunc}
|
||||
\alias{serializeFunc}
|
||||
\title{Serialize the Body of a Function}
|
||||
\usage{
|
||||
serializeFunc(publishedFunction)
|
||||
}
|
||||
\arguments{
|
||||
\item{string}{function name to serialize}
|
||||
}
|
||||
\value{
|
||||
output (fromJSON)
|
||||
}
|
||||
\description{
|
||||
Change function to accept a dataframe
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/serialize.R
|
||||
\name{serializeI}
|
||||
\alias{serializeI}
|
||||
\title{Serialize the input}
|
||||
\usage{
|
||||
serializeI(input)
|
||||
}
|
||||
\arguments{
|
||||
\item{list}{Take arguments of a function in type list}
|
||||
}
|
||||
\value{
|
||||
serialized input expectations
|
||||
}
|
||||
\description{
|
||||
Create a serialized dataFrame with the input arguments
|
||||
|
||||
Expecting:
|
||||
inputSchema = list("arg1"="type", "arg2"="type", ...)
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/serialize.R
|
||||
\name{serializeMeta}
|
||||
\alias{serializeMeta}
|
||||
\title{Serialize (Published) User Arguments}
|
||||
\usage{
|
||||
serializeMeta(userDF, funcName)
|
||||
}
|
||||
\arguments{
|
||||
\item{dataframe}{Pass dataframe into function}
|
||||
}
|
||||
\value{
|
||||
serialized output
|
||||
}
|
||||
\description{
|
||||
Take Output from function and save into output dataframe
|
||||
Expect arguments from user in a dataframe
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/serialize.R
|
||||
\name{serializeO}
|
||||
\alias{serializeO}
|
||||
\title{Serialize the output}
|
||||
\usage{
|
||||
serializeO(output)
|
||||
}
|
||||
\arguments{
|
||||
\item{list}{Take arguments of a function in type list}
|
||||
}
|
||||
\value{
|
||||
serialized output expectations
|
||||
}
|
||||
\description{
|
||||
Serialize the output DataFrame
|
||||
Expecting:
|
||||
outputSchema = list("output1"="type", "output2"="type", ...)
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
% Generated by roxygen2 (4.1.1): do not edit by hand
|
||||
% Please edit documentation in R/serialize.R
|
||||
\name{unserializeMeta}
|
||||
\alias{unserializeMeta}
|
||||
\title{Serialize (Published) Output}
|
||||
\usage{
|
||||
unserializeMeta(output)
|
||||
}
|
||||
\arguments{
|
||||
\item{dataframe}{Pass dataframe back to user}
|
||||
}
|
||||
\value{
|
||||
output dataframe
|
||||
}
|
||||
\description{
|
||||
This is an internal funciton
|
||||
Take Output from function and save into output dataframe
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче