[R-sig-Geo] accuracy assessment of tematic maps in R

Bede-Fazekas Ákos bfalevlist at gmail.com
Thu Dec 31 09:10:41 CET 2015


Dear Cristián,
there migt be several packages that can compute confusion matrix (aka. 
contingency table):
??contingency

One of them that I can recommend you is package 'ROCR' and functions 
ROCR::prediction() and ROCR::performance().

## Creates a ROCR::prediction object:
ROCR_object <- prediction(predictions = predicted_values, labels = 
observed_values)

## Calculates performance measures:
AUC_value <- performance(prediction.obj = ROCR_object, measure = 
"auc")@y.values[[1]]
TPR_value <- performance(prediction.obj = ROCR_object, measure = 
"tpr")@y.values[[1]]

## Calculates performance graphs:
ROC_curve <- performance(prediction.obj = ROCR_object, measure = "tpr", 
x.measure = "fpr")
precision_recall <- performance(prediction.obj = ROCR_object, measure = 
"prec", x.measure = "rec")
sensitivity_specificity <- performance(prediction.obj = ROCR_object, 
measure = "sens", x.measure = "spec")
plot(ROC_curve)
plot(precision_recall)
plot(sensitivity_specificity)

HTH,
Ákos Bede-Fazekas
Hungary

2015.12.31. 4:31 keltezéssel, CRISTIAN ANDRES VERGARA FERNANDEZ írta:
> Dear all,
>
> I have done a number of land cover maps using support vector machine from
> landsat 8. I would like to automatize an accuracy assessment procedure
> based on a confusion matrix to evaluate the classification maps obtained. I
> have not been able to easily find a package containing the confusion matrix
> function. Would you recommend me a way to do this using R?
>
> Many thanks in advance
>



More information about the R-sig-Geo mailing list