<commit_before># Azure-MachineLearning-ClientLibrary-R

This package provides an interface to access web services on Microsoft Azure Machine Learning (MAML) from your local R environment. There are three main functionalities:
- publish: define a custom function or train a model and publish it to MAML
- discover: browse web services that are available to your workspace
- consume: use available web service from R in a variety of convenient formats

This is a technology preview. The APIs used by the package are still subject to change. Please send any bugs or comments you have to the maintainers listed.

## Installing the package

Currently the package lives only on this GitHub repo. You can install the package and the dependencies via the following lines in R:

```
install.packages(c("RCurl", "RJSONIO", "uuid", "jsonlite", "codetools", "base64enc", "httr", "data.table", "df2json", "rjson", "devtools"), repos = "http://cran.r-project.org")
devtools::install_github("Azure-MachineLearning-ClientLibrary-R", "Azure", subdir="maml")
```

Also, you will need to install [R tools](https://cran.r-project.org/bin/windows/Rtools/) and 
make sure that a zipper is included in your PATH variable (instructions [here](http://stackoverflow.com/questions/29129681/create-zip-file-error-running-command-had-status-127))

We plan on releasing the package to CRAN eventually.


## Using the package

Currently the APIs we are using are only deployed internally, so please go [here](studio.azureml-int.net) and create an account. 
After logging in, under the "Settings" tab, copy and paste your workspace ID from the "Name" sub-tab into your R console. From the "Authorization Tokens" sub-tab, copy your primary authorization token into your R console. You will need this information to access all package functionality.

We expect to migrate to the production version of Azure within a few weeks.


## Publishing a web service

The primary functionality implemented by this package is the capability to publish a model from R to Azure Machine Learning without having to copy and paste your R script to the Machine Learning Studio UI. Publishing a function is now a simple one line function call.

```
publishWebService(functionName, serviceName, inputSchema, outputSchema, wkID, authToken)
```

The publish function takes in the name of the function to be published as a string, the name to be displayed on Azure, your workspace ID, and your authorization token. The function also requires the input and output schemas of the function to be published, which is a list of the format

```
list("arg1"=<type>, "arg2"=<type>, ...)
```

The publish function can take in a function that uses arbitrary packages. However, the function can only take in as input primitive data types, meaning that functions that take in dataframes, lists, or other complex objects are currently not supported. 
The R datatypes supported are as follows:
- float, double
- date-time
- string
- time-span
- uint16, int16, uint32, int32, uint64, int64
- int
- bool
If using a factor variable, it is recommend you use strings instead, e.g. "male" and "female"<commit_msg>formatting<commit_after># Azure-MachineLearning-ClientLibrary-R

This package provides an interface to access web services on Microsoft Azure Machine Learning (MAML) from your local R environment. There are three main functionalities:
- publish: define a custom function or train a model and publish it to MAML
- discover: browse web services that are available to your workspace
- consume: use available web service from R in a variety of convenient formats

This is a technology preview. The APIs used by the package are still subject to change. Please send any bugs or comments you have to the maintainers listed.

## Installing the package

Currently the package lives only on this GitHub repo. You can install the package and the dependencies via the following lines in R:

```
install.packages(c("RCurl", "RJSONIO", "uuid", "jsonlite", "codetools", "base64enc", "httr", "data.table", "df2json", "rjson", "devtools"), repos = "http://cran.r-project.org")
devtools::install_github("Azure-MachineLearning-ClientLibrary-R", "Azure", subdir="maml")
```

Also, you will need to install [R tools](https://cran.r-project.org/bin/windows/Rtools/) and 
make sure that a zipper is included in your PATH variable (instructions [here](http://stackoverflow.com/questions/29129681/create-zip-file-error-running-command-had-status-127))

We plan on releasing the package to CRAN eventually.


## Using the package

Currently the APIs we are using are only deployed internally, so please go [here](studio.azureml-int.net) and create an account. 
After logging in, under the "Settings" tab, copy and paste your workspace ID from the "Name" sub-tab into your R console. From the "Authorization Tokens" sub-tab, copy your primary authorization token into your R console. You will need this information to access all package functionality.

We expect to migrate to the production version of Azure within a few weeks.


## Publishing a web service

The primary functionality implemented by this package is the capability to publish a model from R to Azure Machine Learning without having to copy and paste your R script to the Machine Learning Studio UI. Publishing a function is now a simple one line function call.

```
publishWebService(functionName, serviceName, inputSchema, outputSchema, wkID, authToken)
```

The publish function takes in the name of the function to be published as a string, the name to be displayed on Azure, your workspace ID, and your authorization token. The function also requires the input and output schemas of the function to be published, which is a list of the format

```
list("arg1"=<type>, "arg2"=<type>, ...)
```

The publish function can take in a function that uses arbitrary packages. However, the function can only take in as input primitive data types, meaning that functions that take in dataframes, lists, or other complex objects are currently not supported. 
The R datatypes supported are as follows:
- float, double
- date-time
- string
- time-span
- uint16, int16, uint32, int32, uint64, int64
- int
- bool

If using a factor variable, it is recommend you use strings instead, e.g. "male" and "female"
{'fraction_non_alphanumeric': 0.07397959183673469, 'fraction_numerical': 0.008928571428571428, 'mean_word_length': 4.73400365630713, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6825758', 'n_tokens_mistral': 1659, 'n_tokens_neox': 1570, 'n_words': 861}