GetAccuracyOverTimePlotPreview: Retrieve Accuracy over Time preview plot for a model.

View source: R/DatetimeTrendPlots.R

GetAccuracyOverTimePlotPreviewR Documentation

Retrieve Accuracy over Time preview plot for a model.

Description

Retrieve Accuracy over Time preview plot for a model.

Usage

GetAccuracyOverTimePlotPreview(
  model,
  backtest = 0,
  source = SourceType$Validation,
  seriesId = NULL,
  forecastDistance = NULL,
  maxWait = 600
)

Arguments

model

An S3 object of class dataRobotModel like that returned by the function GetModel, or each element of the list returned by the function ListModels.

backtest

integer or character. Optional. Retrieve plots for a specific backtest. Use the backtest index starting from zero. To retrieve plots for holdout, use DataSubset$Holdout.

source

character. Optional. The source of the data for the backtest/holdout. Must be one of SourceType.

seriesId

character. Optional. The name of the series to retrieve for multiseries projects. If not provided an average plot for the first 1000 series will be retrieved.

forecastDistance

integer. Optional. Forecast distance to retrieve the chartdata for. If not specified, the first forecast distance for this project will be used. Only available for time series projects.

maxWait

integer. Optional. The maximum time to wait for a compute job to complete before retrieving the plots. Default is 600. If 0, the plots would be retrieved without attempting the computation.

Value

list with the following components:

  • startDate. POSIXct: The datetime of the start of the chartdata (inclusive).

  • endDate. POSIXct: The datetime of the end of the chartdata (exclusive).

  • bins. data.frame: Each row represents a bin in the plot. Dataframe has following columns:

    • startDate. POSIXct: The datetime of the start of the bin (inclusive).

    • endDate. POSIXct: The datetime of the end of the bin (exclusive).

    • actual. numeric: Average actual value of the target in the bin. NA if there are no entries in the bin.

    • predicted. numeric: Average prediction of the model in the bin. NA if there are no entries in the bin.

Examples

## Not run: 
projectId <- "59a5af20c80891534e3c2bde"
modelId <- "5996f820af07fc605e81ead4"
model <- GetModel(projectId, modelId)
plot <- GetAccuracyOverTimePlotPreview(model)
png("accuracy_over_time_preview.png", width = 1200, height = 600, units = "px")
par(mar = c(10, 5, 5, 5))
plot(plot$bins$startDate, plot$bins$actual, type = "l", ylab = "Target", xaxt = "n", xlab = "")
lines(plot$bins$startDate, plot$bins$predicted, col = "red")
axis(1, plot$bins$startDate, format(plot$bins$startDate, "%Y-%m-%d"), las = 3)
title(xlab = "Date", mgp = c(7, 1, 0))
legend("topright", legend = c("Actual", "Predicted"), col = c("black", "red"), lty = 1:1)
dev.off()

## End(Not run)

datarobot documentation built on May 29, 2024, 4:36 a.m.