Learn R Programming

civis (version 2.1.0)

fetch_predictions: Retrieve predictions from a CivisML prediction job

Description

Retrieve predictions from a CivisML prediction job

Usage

fetch_predictions(x, ...)

Arguments

x

civis_ml_prediction object from predict.civis_ml

...

arguments passed to read.csv

Value

A data.frame of predictions containing an additional column with a primary key. For a multiclass model, a data frame is returned with one column of predictions for each class.

Details

Predictions can also be downloaded as a csv directly using download_civis (see examples).

Examples

Run this code
# NOT RUN {
m <- civis_ml("path/to/file.csv", model_type = "sparse_logistic",
  dependent_variable = "Species")
pred_job <- predict(m, newdata = "path/to/newdata.csv")
yhat <- fetch_predictions(pred_job)

# download instead:
download_civis(pred_job$model_info$output_file_ids, path = "my_predictions.csv")

# }

Run the code above in your browser using DataLab