Learn R Programming

RTextTools (version 1.3.8)

create_precisionRecallSummary: creates a summary with precision, recall, and F1 scores.

Description

Creates a summary with precision, recall, and F1 scores for each algorithm broken down by unique label.

Usage

create_precisionRecallSummary(corpus, classification_results, b_value = 1)

Arguments

corpus
Class of type matrix_container-class generated by the create_corpus function.
classification_results
A cbind() of result objects returned by classify_model, or the object returned by classify_models.
b_value
b-value for generating precision, recall, and F-scores statistics.

Examples

Run this code
library(RTextTools)
data <- read_data(system.file("data/NYTimes.csv.gz",package="RTextTools"),type="csv")
data <- data[sample(1:3100,size=100,replace=FALSE),]
matrix <- create_matrix(cbind(data$Title,data$Subject), language="english", 
removeNumbers=TRUE, stemWords=FALSE, weighting=weightTfIdf)
corpus <- create_corpus(matrix,data$Topic.Code,trainSize=1:75, testSize=76:100, 
virgin=FALSE)
models <- train_models(corpus, algorithms=c("MAXENT","SVM"))
results <- classify_models(corpus, models)
precision_recall_f1 <- create_precisionRecallSummary(corpus, results)

Run the code above in your browser using DataLab