Learn R Programming

ssc (version 1.0)

bClassif: Base Classifier Specification

Description

This function defines a supervised classifier specification with the format expected by the semi-supervised classifiers in this package.

Usage

bClassif(train, predClass, predProb, ...)

Arguments

train
a function to train a supervised classifier. This function should return the model trained. For usage information see Details.
predClass
a function to predict the class of instances, using the model trained with train. This function should return a vector with the predicted classes. For usage information see Details.
predProb
a function to predict the probabilities per class of instances, using the model trained with train. This function should return a matrix with the predicted probabilities. The matrix, should have: the number of rows equal to the size of prediction set and the number of columns equal to the number of possible classes. For usage information see Details.
...
additional arguments passed to train.

Value

The classifier specification stored in a list of class bClassif.

Details

The train function is used as follows:

model <- train(m, y, ...)

The training data is provided in the two first arguments. Here, m is a distance matrix between the training instances and y is a vector with the classes of those instances. Additional arguments of the classifier can be passed to train through the additional arguments (...) specified in bClassif.

The predClass and predProb functions are used as follows:

cls <- predClass(model, pm) cls <- predProb(model, pm)

In both cases, the prediction data is supplied using pm. pm is a distance matrix with the following dimensions: the number of rows equal to the size of the prediction set and the number of columns equal to the size of the training set. predClass returns a vector with the predicted classes and predProb returns a matrix that contains the class probabilities. In this matrix, there is a column for each class and a row for each instance.