recall_accuracy: calculates the recall accuracy of the classified data.

Description Usage Arguments Author(s) Examples

View source: R/recall_accuracy.R

Description

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

Usage

1
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, Timothy P. Jurka

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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("RF","SVM"))
results <- classify_models(container, models)
analytics <- create_analytics(container, results)
recall_accuracy(analytics@document_summary$MANUAL_CODE,
analytics@document_summary$RF_LABEL)
recall_accuracy(analytics@document_summary$MANUAL_CODE,
analytics@document_summary$SVM_LABEL)

Example output

Loading required package: SparseM

Attaching package: 'SparseM'

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

    backsolve

[1] 0
[1] 0.08

RTextTools documentation built on April 26, 2020, 9:05 a.m.