Description Usage Arguments Details Value Author(s) References See Also Examples
This function calculates the values of Precision and Recall of a set of predicted signals, given the set of true signals. The function assumes three types of signals: 'b' (Buy), 's' (Sell) and 'h' (Hold). The function returns the values of Precision and Recall for the buy, sell and sell+buy signals.
1 | sigs.PR(preds, trues)
|
preds |
A factor with the predicted signals (values should be 'b','s', or 'h') |
trues |
A factor with the predicted signals (values should be 'b','s', or 'h') |
Precision and recall are two evaluation statistics often used to evaluate predictions for rare events. In this case we are talking about buy and sell opportunities.
Precision is the proportion of the events signaled by a model that actually occurred. Recall is a proportion of events that occurred that the model was able to capture. Ideally, the models should aim to obtain 100% precision and recall. However, it is often the case that there is a trade-off between the two statistics.
A matrix with three rows and two columns. The columns are the values of Precision and Recall, respectively. The rows are the values for the three different events (sell, buy and sell+buy).
Luis Torgo ltorgo@dcc.fc.up.pt
Torgo, L. (2016) Data Mining using R: learning with case studies, second edition, Chapman & Hall/CRC (ISBN-13: 978-1482234893).
trading.signals
, tradingEvaluation
, trading.simulator
1 2 3 4 5 6 | ## A simple illustrative example use with random signals
ind <- rnorm(sd=0.3,100)
sigs <- trading.signals(ind,b.t=0.1,s.t=-0.1)
indT <- rnorm(sd=0.3,100)
sigsT <- trading.signals(indT,b.t=0.1,s.t=-0.1)
sigs.PR(sigs,sigsT)
|
precision recall
s 0.2903226 0.2571429
b 0.3684211 0.3333333
s+b 0.3333333 0.2987013
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.