summary.nbc {nbc4va}R Documentation

Summarize a NBC model with metrics

Description

Summarizes the results from a nbc object. The summary can be either for a particular case or for the entirety of cases.

Usage

## S3 method for class 'nbc'
summary(object, top = 5, id = NULL, csmfa.obs = NULL, ...)

Arguments

object

The result nbc object.

top

A number that produces top causes depending on id:

  • If (id is char): provide the top causes of the case by probability

  • If (id is NULL): provide the top causes by predicted Cause Specific Mortality Fractions (CSMF)

id

A character representing a case id in the test data.

csmfa.obs

A character vector of the true causes for calculating the CSMF accuracy.

...

Additional arguments to be passed if applicable

Details

See Methods documentation for details on calculations and metrics.

Value

out A summary object built from a nbc object with modifications/additions:

See Also

Other main functions: nbc(), plot.nbc(), print.nbc_summary()

Examples

library(nbc4va)
data(nbc4vaData)

# Run naive bayes classifier on random train and test data
train <- nbc4vaData[1:50, ]
test <- nbc4vaData[51:100, ]
results <- nbc(train, test)

# Obtain a summary for the results
brief <- summary(results, top=2)  # top 2 causes by CSMF for all test data
briefID <- summary(results, id="v48")  # top 5 causes by probability for case "v48"


[Package nbc4va version 1.2 Index]