Package 'SigOptR'

Title: R API Wrapper for SigOpt
Description: Interfaces with the 'SigOpt' API. More info at <https://sigopt.com>.
Authors: Alexandra Johnson [aut, cre]
Maintainer: Alexandra Johnson <[email protected]>
License: MIT + file LICENSE
Version: 0.0.1
Built: 2024-11-08 06:17:20 UTC
Source: CRAN

Help Index


Create an experiment

Description

Create an experiment

Usage

create_experiment(body)

Arguments

body

POST body of create request

Value

experiment created by SigOpt

Examples

env <- Sys.getenv("NOT_CRAN")
if (!identical(env, "true")) {
0
} else {
create_experiment(list(
  name="R test experiment",
  parameters=list(
    list(name="x1", type="double", bounds=list(min=0, max=100)),
    list(name="x2", type="double", bounds=list(min=0, max=100))
  )
))}

Create an observation for an experiment

Description

Create an observation for an experiment

Usage

create_observation(experiment_id, body)

Arguments

experiment_id

the id of an experiment to create an observation for

body

POST body of create request

Value

observation created by SigOpt

Examples

env <- Sys.getenv("NOT_CRAN")
if (!identical(env, "true")) {
0
} else {
experiment <- create_experiment(list(
  name="R test experiment",
  parameters=list(
    list(name="x1", type="double", bounds=list(min=0, max=100)),
    list(name="x2", type="double", bounds=list(min=0, max=100))
  )
))
suggestion <- create_suggestion(experiment$id)
create_observation(experiment$id, list(suggestion=suggestion$id, value=99.08))
create_observation(experiment$id, list(suggestion=suggestion$id, value=99.58, value_stddev=0.1))}

Create a suggestion for an experiment

Description

Create a suggestion for an experiment

Usage

create_suggestion(experiment_id, body = NULL)

Arguments

experiment_id

the id of an experiment to create an suggestion for

body

POST body of create request

Value

suggestion created by SigOpt

Examples

env <- Sys.getenv("NOT_CRAN")
if (!identical(env, "true")) {
0
} else {
experiment <- create_experiment(list(
  name="R test experiment",
  parameters=list(
    list(name="x1", type="double", bounds=list(min=0, max=100)),
    list(name="x2", type="double", bounds=list(min=0, max=100))
  )
))
create_suggestion(experiment$id)}

Fetch an experiment

Description

Fetch an experiment

Usage

fetch_experiment(experiment_id, body = NULL)

Arguments

experiment_id

the id of an experiment to fetch

body

Url params of GET request

Value

SigOpt experiment with id experiment_id

Examples

env <- Sys.getenv("NOT_CRAN")
if (!identical(env, "true")) {
0
} else {
experiment <- create_experiment(list(
  name="R test experiment",
  parameters=list(
    list(name="x1", type="double", bounds=list(min=0, max=100)),
    list(name="x2", type="double", bounds=list(min=0, max=100))
  )
))
fetch_experiment(experiment$id)}

Franke function - http://www.sfu.ca/~ssurjano/franke2d.html

Description

Franke function - http://www.sfu.ca/~ssurjano/franke2d.html

Usage

franke(x, y)

Arguments

x

First dimension

y

Second dimension

Value

The franke function evaluated at x,y

Examples

franke(0,1)

Get the SigOpt API token from the SIGOPT_API_TOKEN environment variable or user input

Description

Get the SigOpt API token from the SIGOPT_API_TOKEN environment variable or user input

Usage

sigopt_api_token(force = FALSE)

Arguments

force

force entry of SigOpt API token, even if present

Value

SigOpt API token


Get the SigOpt API url from the SIGOPT_API_URL environment variable or use default Most users will be ok with the default value

Description

Get the SigOpt API url from the SIGOPT_API_URL environment variable or use default Most users will be ok with the default value

Usage

sigopt_api_url()

Value

Base url for SigOpt API requests

See Also

sigopt_GET and sigopt_POST, which perform the HTTP requests


User agent for current version of SigOpt R API Client

Description

User agent for current version of SigOpt R API Client

Usage

sigopt_api_user_agent()

Value

User agent

See Also

sigopt_GET and sigopt_POST, which perform the HTTP requests


Create authentication for SigOpt API, using HTTP Basic Auth

Description

Create authentication for SigOpt API, using HTTP Basic Auth

Usage

sigopt_auth(api_token = sigopt_api_token())

Arguments

api_token

SigOpt API token

Value

http basic authentiation with api_token as username and no password


Check content returned by the SigOpt API

Description

Check content returned by the SigOpt API

Usage

sigopt_check(req)

Arguments

req

result of request to the SigOpt API

Value

invisible(), stops if there is an error status code

See Also

sigopt_GET and sigopt_POST, which call this function interally


GET request to SigOpt API path, with json encoded body

Description

GET request to SigOpt API path, with json encoded body

Usage

sigopt_GET(path, query = NULL, api_token = sigopt_api_token())

Arguments

path

path of SigOpt API url to POST to

query

list of query parameters to be url-encoded

api_token

SigOpt api token

Value

result of request to SigOpt API, needs to be JSON decoded

See Also

sigopt_parse, which parses the result of this function


Parse content returned by the SigOpt API

Description

Parse content returned by the SigOpt API

Usage

sigopt_parse(req)

Arguments

req

result of request to the SigOpt API

Value

json decoding of request object

See Also

sigopt_GET and sigopt_POST, which call this function interally


POST request to SigOpt API path, with json encoded body

Description

POST request to SigOpt API path, with json encoded body

Usage

sigopt_POST(path, body, api_token = sigopt_api_token())

Arguments

path

path of SigOpt API url to POST to

body

POST body, will be json-encoded

api_token

SigOpt api token

Value

result of request to SigOpt API, needs to be JSON decoded

See Also

sigopt_parse, which parses the result of this function