summary.nbc: Summarize a NBC model with metrics

Description Usage Arguments Details Value See Also Examples

View source: R/nbc4va_main.R

Description

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

Usage

1
2
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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"

nbc4va documentation built on May 2, 2019, 1:42 p.m.