Learn R Programming

flashlight (version 0.3.0)

ale_profile: ALE profile

Description

Internal function used by light_profile to calculate ALE profiles.

Usage

ale_profile(x, v, breaks = NULL, n_bins = 11, cut_type = c("equal",
  "quantile"), value_name = "value", counts_name = "counts",
  counts = TRUE, counts_weighted = FALSE, pred = NULL,
  evaluate_at = NULL, indices = NULL, n_max = 1000, seed = NULL,
  two_sided = FALSE, calibrate = TRUE)

Arguments

x

An object of class flashlight.

v

The variable to be profiled.

breaks

Cut breaks for a numeric v. Only used if no evaluate_at is specified.

n_bins

Maxmium number of unique values to evaluate for numeric v. Only used if no evaluate_at is specified.

cut_type

For the default "equal", bins of equal width are created for v by pretty. Choose "quantile" to create quantile bins.

value_name

Column name containing the profile value. Defaults to "value".

counts_name

Name of the column containing counts if counts is TRUE.

counts

Should counts be added?

counts_weighted

If counts is TRUE: Should counts be weighted by the case weights? If TRUE, the sum of w is returned by group.

pred

Optional vector with predictions.

evaluate_at

Vector with values of v used to evaluate the profile. Only relevant for type = "partial dependence".

indices

A vector of row numbers to consider.

n_max

Maximum number of ICE profiles to calculate within interval (not within data).

seed

Integer random seed passed to light_ice.

two_sided

Standard ALE profiles are calculated via left derivatives. Set to TRUE if two-sided derivatives should be calculated. Only works for continuous v. More specifically: Usually, local effects at value x are calculated using points between x-e and x. Set ale_two_sided = TRUE to use points between x-e/2 and x+e/2.

calibrate

Should values be calibrated based on average preditions? Default is TRUE.

Value

A tibble containing results.