| accuracy {fda.usc} | R Documentation |
Performance measures for regression and classification models
Description
cat2meas and tab2meas calculate the measures for a multiclass classification model.
pred2meas calculates the measures for a regression model.
Usage
cat2meas(yobs, ypred, measure = "accuracy", cost = rep(1, nlevels(yobs)))
tab2meas(tab, measure = "accuracy", cost = rep(1, nrow(tab)))
pred.MSE(yobs, ypred)
pred.RMSE(yobs, ypred)
pred.MAE(yobs, ypred)
pred2meas(yobs, ypred, measure = "RMSE")
Arguments
yobs |
A vector of the labels, true class or observed response. Can be |
ypred |
A vector of the predicted labels, predicted class or predicted response. Can be |
measure |
Type of measure, see |
cost |
Cost value by class (only for input factors). |
tab |
Confusion matrix (Contingency table: observed class by rows, predicted class by columns). |
Details
-
cat2meascomputetab=table(yobs,ypred)and callstab2measfunction. -
tab2measfunction computes the following measures (seemeasureargument) for a binary classification model:-
accuracythe accuracy classification score -
recall,sensitivity,TPrateR=TP/(TP+FN) -
precisionP=TP/(TP+FP) -
specificity,TNrateTN/(TN+FP) -
FPrateFP/(TN+FP) -
FNrateFN/(TP+FN) -
Fmeasure2/(1/R+1/P) -
Gmeansqrt(R*TN/(TN+FP)) -
kappathe kappa index -
costsum(diag(tab)/rowSums(tab)*cost)/sum(cost) -
IOUTP/(TP+FN+FP)mean of Intersection over Union -
IOU4classTP/(TP+FN+FP)Intersection over Union by level
-
-
pred2measfunction computes the following measures of error, usign themeasureargument, for observed and predicted vectors:-
MSEMean squared error,\frac{\sum{(ypred- yobs)^2}}{n} -
RMSERoot mean squared error\sqrt{\frac{\sum{(ypred- yobs)^2}}{n} } -
MAEMean Absolute Error,\frac{\sum |yobs - ypred|}{n}
-
See Also
Other performance:
weights4class()