rmw_predict: Function to predict using a *ranger* random forest.

View source: R/rmw_predict.R

rmw_predictR Documentation

Function to predict using a ranger random forest.

Description

Function to predict using a ranger random forest.

Usage

rmw_predict(model, df = NA, se = FALSE, n_cores = NULL, verbose = FALSE)

Arguments

model

A ranger model object from rmw_train_model.

df

Input data to be used for predictions.

se

If df is supplied, should the standard error of the prediction be calculated too? The standard error method is the "infinitesimal jackknife for bagging" and will slow down the predictions significantly.

n_cores

Number of CPU cores to use for the model predictions.

verbose

Should the function give messages?

Value

Numeric vector or a named list containing two numeric vectors.

Author(s)

Stuart K. Grange

Examples


# Load package
library(dplyr)

# Prepare example data
data_london_prepared <- data_london %>% 
  filter(variable == "no2") %>% 
  rmw_prepare_data()

# Make a prediction with the examples
vector_prediction <- rmw_predict(
  model_london, 
  df = data_london_prepared
)


# Make a prediction with standard errors too
list_prediction <- rmw_predict(
  model_london, 
  df = data_london_prepared,
  se = TRUE
)
 

rmweather documentation built on June 22, 2024, 9:33 a.m.