OPTaaS (Optimization as a Service) is a general-purpose Bayesian optimizer developed by Mind Foundry which provides optimal hyper-parameter configurations via web-services. It can handle any parameter type and does not need to know the underlying process, models, or data.
This R client makes it easier to interact with the web service and integrate with your R code.
```{r gh-installation, eval = FALSE}
devtools::install_github("MindFoundry/optaas-r-client") library(optaas.client)
## Usage
Connect to your OPTaaS server:
```{r example, eval = FALSE}
client <- OPTaaSClient$new("Your OPTaaS URL", "Your OPTaaS API Key")
Define your parameters: ```{r example, eval = FALSE} parameters <- list( BoolParameter('my_bool'), CategoricalParameter('my_cat', values=list('a', 'b', 'c'), default='c'), ChoiceParameter('ints_or_floats', choices=list( GroupParameter('ints', items=list( IntParameter('my_int', minimum=0, maximum=20), IntParameter('my_optional_int', minimum=-10, maximum=10, optional=TRUE) )), GroupParameter('floats', items=list( FloatParameter('float1', minimum=0, maximum=1), FloatParameter('float2', minimum=0.5, maximum=4.5) )) )) )
Define your scoring function:
```{r example, eval = FALSE}
scoring_function <- function(my_bool, my_cat, ints_or_floats) {
score <- if (isTRUE(my_bool)) 5 else -5
score <- if (my_cat == 'a') score + 1 else score + 3
if (!is.null(ints_or_floats$ints)) {
score <- score + do.call(sum, ints_or_floats$ints)
} else {
score <- score * do.call(sum, ints_or_floats$floats)
}
score
}
Create your task: ```{r example, eval = FALSE} task <- client$create_task( title="Dummy task", parameters=parameters, goal="min", # optional (default is "max") min_known_score=-22, max_known_score=44 # optional )
Run your task:
```{r example, eval = FALSE}
best_result <- task$run(scoring_function=scoring_function, number_of_iterations=20)
See also our tutorial notebooks.
RStudio is recommended.
Each class/function should be documented using roxygen comments. Use Ctrl+Shift+D
in RStudio to generate the Rd files.
To run tests: set env vars OPTAAS_URL
and OPTAAS_API_KEY
accordingly, then Ctrl+Shift+T
.
To run all checks (including tests): Ctrl+Shift+E
.
For each production release, set the version in the DESCRIPTION
file to match the version of the OPTaaS server and Python client. Then create a new GitHub Release with the same version.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.