Description Usage Arguments Value Examples
A port of pylift's plot function (https://github.com/wayfair/pylift) as of commit: https://github.com/wayfair/pylift/tree/bb69692388b1fe085001c3ba7edf6dd81d888353 pylift: Plots the different kinds of percentage-targeted curves.
1 2 3 |
plue |
the result of a call to the plUpliftEval constructor |
plot_type |
string, optional Either 'qini', 'aqini', 'uplift', 'cuplift', or 'balance'. 'aqini' refers to an adjusted qini plot, 'cuplift' gives a cumulative uplift plot. 'balance' gives the test-control balance for each of the bins. All others are self-explanatory. |
n_bins |
integer, number of population bins; default 20 |
show_theoretical_max |
boolean, optional Toggle theoretical maximal qini curve, if overfitting to treatment/control. Only works for Qini-style curves. |
show_practical_max |
boolean, optional Toggle theoretical maximal qini curve, if not overfitting to treatment/control. Only works for Qini-style curves. |
show_random_selection |
boolean, optional Toggle straight line indicating a random ordering. Only works for Qini-style curves. |
show_no_dogs |
boolean, optional Toggle theoretical maximal qini curve, if you believe there are no sleeping dogs. Only works for Qini-style curves. |
... |
additional arguments |
a pylift plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | set.seed(0)
rl <- function(x){
round(1/(1+exp(-x)))
}
n <- 2000; p <- 3
beta <- -0.5
X <- matrix(rnorm(n*p), n, p)
W <- rbinom(n, 1, 0.5)
Y <- rl(pmax(beta+X[,1], 0) * W + X[,2])
p1 <- 1/(1+exp(-(beta+X[,1])))
plue <- plUpliftEval(W, Y, p1)
pl_plot(plue,
show_practical_max = TRUE,
show_theoretical_max = TRUE,
show_no_dogs = TRUE,
n_bins=20)
library(grf)
set.seed(123)
rl <- function(x){
round(1/(1+exp(-x)))
}
n <- 2000; p <- 10
X <- matrix(rnorm(n*p), n, p)
W <- rbinom(n, 1, 0.2)
Y <- rl(rl(X[,1]) * W - rl(X[,3]) * W + rnorm(n))
tau.forest <- causal_forest(X, Y, W)
tau.hat <- predict(tau.forest, X)
plue <- plUpliftEval(W, Y, tau.hat$predictions)
plue
pl_plot(plue,
show_practical_max = TRUE,
show_theoretical_max = TRUE,
show_no_dogs = TRUE,
n_bins=20)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.