A calendar is an external file that lists events for a time series, such as holidays. For example, we might consider this calendar:
library(knitr) calendar <- read.csv(system.file("extdata", "calendar.csv", package = "datarobot")) kable(calendar)
To explore calendars, let's first connect to DataRobot. First, you must load the DataRobot R package library.
If you have set up a credentials file, library(datarobot)
will initialize a connection to DataRobot automatically. Otherwise, you can specify your endpoint
and apiToken
as in this example to connect to DataRobot directly. For more information on connecting to DataRobot, see the "Introduction to DataRobot" vignette.
library(datarobot) endpoint <- "https://<YOUR DATAROBOT URL GOES HERE>/api/v2" apiToken <- "<YOUR API TOKEN GOES HERE>" ConnectToDataRobot(endpoint = endpoint, token = apiToken)
To create a DataRobot calendar from the CSV file, use CreateCalendar
:
calendar <- CreateCalendar("calendar.csv", name = "holidays") print(calendar)
calendar <- readRDS("calendar.rds") print(calendar)
You can retrieve a calendar from the list of calendars. This will list all calendars across all projects.
calendars <- ListCalendars() calendar <- calendars[[1]] print(calendar)
calendar <- readRDS("calendar.rds") print(calendar)
You can rename the calendar using UpdateCalendar
.
newCalendar <- UpdateCalendar(calendar, name = "newName") print(newCalendar)
calendar <- readRDS("calendar.rds") calendar$name <- "newName" print(calendar)
The main point of having calendars is not to admire them, but to use them for time series modeling! To do this, make a datetime partition like you usually would and pass the calendar using the calendar
parameter.
project <- SetupProject(timeSeriesData, projectName = "time series with calendar") cal <- CreateCalendar("calendar.csv") partition <- CreateDatetimePartitionSpecification("date", autopilotDataSelectionMethod = "duration", useTimeSeries = TRUE, calendar = cal) StartProject(project, partition = partition, target = "target")
You can get the calendar associated with a project using GetCalendarFromProject
projectId <- "59dab74bbd2a54035786bfc0" calendar <- GetCalendarFromProject(project) print(calendar)
calendar <- readRDS("calendar.rds") print(calendar)
To see all the projects associated with a particular calendar, look at the projectIds
parameter of the calendar.
print(calendar$projectIds)
calendar <- readRDS("calendar.rds") calendar$projectIds <- list("59dab74bbd2a54035786bfc0") print(calendar$projectIds)
Calendars can also be shared:
Share(calendar, "other.person.email@your.company.com")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.