Last data update: 2014.03.03

R: calculates the recall accuracy of the classified data.
recall_accuracyR Documentation

calculates the recall accuracy of the classified data.

Description

Given the true labels to compare to the labels predicted by the algorithms, calculates the recall accuracy of each algorithm.

Usage

recall_accuracy(true_labels, predicted_labels)

Arguments

true_labels

A vector containing the true labels, or known values for each document in the classification set.

predicted_labels

A vector containing the predicted labels, or classified values for each document in the classification set.

Author(s)

Loren Collingwood <lorenc2@uw.edu>, Timothy P. Jurka <tpjurka@ucdavis.edu>

Examples

library(RTextTools)
data(NYTimes)
data <- NYTimes[sample(1:3100,size=100,replace=FALSE),]
matrix <- create_matrix(cbind(data["Title"],data["Subject"]), language="english", 
removeNumbers=TRUE, stemWords=FALSE, weighting=tm::weightTfIdf)
container <- create_container(matrix,data$Topic.Code,trainSize=1:75, testSize=76:100, 
virgin=FALSE)
models <- train_models(container, algorithms=c("MAXENT","SVM"))
results <- classify_models(container, models)
analytics <- create_analytics(container, results)
recall_accuracy(analytics@document_summary$MANUAL_CODE,
analytics@document_summary$GLMNET_LABEL)
recall_accuracy(analytics@document_summary$MANUAL_CODE,
analytics@document_summary$MAXENTROPY_LABEL)
recall_accuracy(analytics@document_summary$MANUAL_CODE,
analytics@document_summary$SVM_LABEL)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RTextTools)
Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RTextTools/recall_accuracy.Rd_%03d_medium.png", width=480, height=480)
> ### Name: recall_accuracy
> ### Title: calculates the recall accuracy of the classified data.
> ### Aliases: recall_accuracy
> ### Keywords: method
> 
> ### ** Examples
> 
> library(RTextTools)
> data(NYTimes)
> data <- NYTimes[sample(1:3100,size=100,replace=FALSE),]
> matrix <- create_matrix(cbind(data["Title"],data["Subject"]), language="english", 
+ removeNumbers=TRUE, stemWords=FALSE, weighting=tm::weightTfIdf)
> container <- create_container(matrix,data$Topic.Code,trainSize=1:75, testSize=76:100, 
+ virgin=FALSE)
> models <- train_models(container, algorithms=c("MAXENT","SVM"))
> results <- classify_models(container, models)
> analytics <- create_analytics(container, results)
> recall_accuracy(analytics@document_summary$MANUAL_CODE,
+ analytics@document_summary$GLMNET_LABEL)
[1] 0
> recall_accuracy(analytics@document_summary$MANUAL_CODE,
+ analytics@document_summary$MAXENTROPY_LABEL)
[1] 0
> recall_accuracy(analytics@document_summary$MANUAL_CODE,
+ analytics@document_summary$SVM_LABEL)
[1] 0
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>