classPrototypes: The typical instances of each class - class prototypes

View source: R/rfVisualize.R

classPrototypesR Documentation

The typical instances of each class - class prototypes

Description

For each class the most typical instances are returned based on the highest predicted probability for each class.

Usage

classPrototypes(model, dataset, noPrototypes=10)

Arguments

model

a CoreModel model.

dataset

a dataset from which to get prototypes.

noPrototypes

number of instances of each class to return

Details

The function uses predict.CoreModel(model, dataset) for prediction of the dataset with model. Based on the returned probabilities, it selects the noPrototypes instances with highest probabilities for each class to be typical representatives of that class, i.e., prototypes. The prototypes can be visualized by calling e.g.,
plot(model, dataset, rfGraphType="prototypes", noPrototypes = 10).

Value

A list with the most typical noPrototypes instances is returned. The list has the following attributes.

prototypes

vector with indexes of the most typical instances

clustering

vector with class assignments for typical instances in vector instances

levels

the names of the class values.

Author(s)

John Adeyanju Alao (as a part of his BSc thesis) and Marko Robnik-Sikonja (thesis supervisor)

References

Leo Breiman: Random Forests. Machine Learning Journal, 45:5-32, 2001

See Also

predict.CoreModel, plot.CoreModel.

Examples

dataset <- iris
md <- CoreModel(Species ~ ., dataset, model="rf", rfNoTrees=30,maxThreads=1)
typical <- classPrototypes(md, dataset, 10)
destroyModels(md) # clean up

CORElearn documentation built on Nov. 18, 2022, 5:08 p.m.