plot_2way_comparison: plot_2way_comparison

Description Usage Arguments Value Examples

View source: R/plot_2way_comparison.R

Description

plot to inform which of two models is closer to the actuals. This is done by faceting one score by the other and inspecting if the trend is flat

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plot_2way_comparison(
  actual,
  incumbent_pred,
  proposed_pred,
  weight = rep(1, length(actual)),
  n_bins = 9,
  incumbent_label = "Incumbent",
  proposed_label = "Proposed",
  min_weight = 0,
  rebase = FALSE
)

Arguments

actual

Array[Numeric] - Values we are aiming to predict.

incumbent_pred

Array[Numeric] - Values that we have predicted by the incumbent model. Incumbent is the current model looking to be replaced.

proposed_pred

Optional: String - Text to use to label the proposed predictions.

weight

Optional: Array[Numeric] - Weighting of predictions. If NULL even weighting is used.

n_bins

integerish: number bins to split data into. Works best if n_bins is square number

incumbent_label

Optional: String - Text to use to label the incumbent predictions.

min_weight

Optional: Numeric -minimum value of weight to be included in actual. Raise to remove volatility in "actuals" seen in plots

rebase

Optional: logical - should the scores be rebased to best match the actuals

Value

a list of 2 ggplot objects. Each of these plots shows one score split by the other.

Examples

1
2
3
4
5
6
7
actual <- rnorm(1000)
incumbent_pred <- actual + (rnorm(1000) * 0.1)
proposed_pred <- actual + rnorm(1000)

plot_2way_comparison(actual=actual,
                     incumbent_pred=incumbent_pred,
                     proposed_pred=proposed_pred)

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