Description Usage Arguments Examples
Advances in Financial Machine Learning, Snippet 3.8 page 54. This function recursively eliminates rare observations.
1 | drop_labels(events, min_pct = 0.05)
|
events |
Events with labels |
min_pct |
A fraction used to decide if the observation occurs less than that fraction. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | data("spy")
close <- subset(spy, select = c("index", "close"))
daily_vol <- daily_volatility(close)
cusum_events <- cusum_filter(close, 0.001)
vertical_barriers <- add_vertical_barrier(cusum_events, spy$index, num_days = 1)
events <- get_events(price = close,
t_events = cusum_events,
pt_sl = c(1, 2),
target = daily_vol,
min_ret = 0.005,
vertical_barrier_times=vertical_barriers,
side_prediction=NA)
labels <- get_bins(events, close)
labels_red <- drop_labels(labels, 0.05)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.