ser {IRon} | R Documentation |
Non-Standard Evaluation Metrics
Description
Obtains the squared error of predictions for a given subset of relevance
Usage
ser(trues, preds, phi.trues = NULL, ph = NULL, t = 0)
Arguments
trues |
Target values from a test set of a given data set. Should be a vector and have the same size as the variable preds |
preds |
Predicted values given a certain test set of a given data set. Should be a vector and have the same size as the variable preds |
phi.trues |
Relevance of the values in the parameter trues. Use ??phi() for more information. Defaults to NULL |
ph |
The relevance function providing the data points where the pairs of values-relevance are known. Default is NULL |
t |
Relevance cut-off. Default is 0. |
Details
Squared Error-Relevance Metric (SER)
Value
Squared error for for cases where the relevance of the true value is greater than t (SERA)
Examples
library(IRon)
library(rpart)
if(requireNamespace("rpart")) {
data(accel)
form <- acceleration ~ .
ind <- sample(1:nrow(accel),0.75*nrow(accel))
train <- accel[ind,]
test <- accel[-ind,]
ph <- phi.control(accel$acceleration)
m <- rpart::rpart(form, train)
preds <- as.vector(predict(m,test))
trues <- test$acceleration
phi.trues <- phi(test$acceleration,ph)
ser(trues,preds,phi.trues)
}
[Package IRon version 0.1.4 Index]