plot_feature_predictions: plot_feature_predictions

Description Usage Arguments Examples

View source: R/plot_feature_predictions.R

Description

function to plot the prediction vs the actual over a given feature. This allows analysis of how well the predictions fit over the feature. This function DOES NOT give the marginal effect of a feature, this is due to correlations with other features

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
plot_feature_predictions(
  feature,
  feature_name,
  actual,
  prediction,
  weight = rep(1, length(feature)),
  exposure_type = "pdf",
  n_bins = 10,
  use_plotly = TRUE
)

Arguments

feature

- vector of factor to be plotted over

feature_name

- Name of factor to be plotted over. Will be used to label plots

actual

- array[numeric] - target variable

prediction

- array[numeric] - prediction of target variable

weight

numeric - Vector of length nrow(data) contains weightings, if NULL even weighting is used

exposure_type

- character. either 'pdf' or 'count'. Method used to plot exposure

n_bins

numeric - Vector of length 1 for 1D plot and 1 or 2 for 2D plots. This is the number of points to calculate the PDP for

use_plotly

Optional: boolean - If TRUE plotly object is returned else ggplot2 object

Examples

1
2
3
4
plot_feature_predictions(feature=rep(1:10, each = 10),
feature_name= "Example",
actual=1:100,
prediction=1:100 + 10 * rnorm(100))

gloverd2/codeBase documentation built on Dec. 20, 2021, 11:48 a.m.