yat  0.14.5pre
Public Member Functions | List of all members
theplu::yat::classifier::SupervisedClassifier Class Referenceabstract

Interface class for supervised classifiers that use data in a matrix format. More...

#include <yat/classifier/SupervisedClassifier.h>

Inheritance diagram for theplu::yat::classifier::SupervisedClassifier:
theplu::yat::classifier::KNN< Distance, NeighborWeighting > theplu::yat::classifier::NBC theplu::yat::classifier::NCC< Distance >

Public Member Functions

 SupervisedClassifier (void)
 Constructor.
 
virtual ~SupervisedClassifier (void)
 Destructor.
 
virtual SupervisedClassifiermake_classifier () const =0
 Create an untrained copy of the classifier. More...
 
virtual void predict (const MatrixLookup &data, utility::Matrix &result) const =0
 Make predictions for unweighted test data. More...
 
virtual void predict (const MatrixLookupWeighted &data, utility::Matrix &result) const =0
 Make predictions for weighted test data. More...
 
virtual void train (const MatrixLookup &data, const Target &targets)=0
 Train the classifier using unweighted training data with known targets. More...
 
virtual void train (const MatrixLookupWeighted &data, const Target &targets)=0
 Train the classifier using weighted training data with known targets. More...
 

Detailed Description

Interface class for supervised classifiers that use data in a matrix format.

The data matrix is organized with data points (samples) as columns with rows corresponding to variables for the data points. Supervised classifiers that do not use data in this format include kernel-based classifiers such as SVM. A supervised classifier is trained on training data for which a class of each data point is known and used in the training. A trained supervised classifier can be used to predict the class of test samples.

Member Function Documentation

virtual SupervisedClassifier* theplu::yat::classifier::SupervisedClassifier::make_classifier ( ) const
pure virtual

Create an untrained copy of the classifier.

An interface for making new classifier objects. This function allows for specification at run-time of which classifier type to instatiate (see 'Prototype' in Design Patterns). Derived classes should implement this function with DerivedClass* as the return type and not SupervisedClassifier*. A dynamically allocated DerivedClassifier should be returned. The implementation of this function should correspond to a copy constructor with the exception that the returned classifier is not trained.

Returns
A dynamically allocated classifier, which has to be deleted by the caller to avoid memory leaks.

Implemented in theplu::yat::classifier::KNN< Distance, NeighborWeighting >, theplu::yat::classifier::NCC< Distance >, and theplu::yat::classifier::NBC.

virtual void theplu::yat::classifier::SupervisedClassifier::predict ( const MatrixLookup data,
utility::Matrix result 
) const
pure virtual

Make predictions for unweighted test data.

Samples in data are predicted and predictions for all classes are returned in result. The test data data should have one column per test sample and one row for each variable measured for the test samples. The rows of data should be ordered identical to the rows of the data used to train the classifier, so that a given row corresponds to the same variable for both training and test data. The predictions in result have one column for each sample in data, ordered in the same order, and one row for each class as defined by the targets used to train the classifier. Derived classes should implement this function such that unweighted calculations are used throughout when both training and test data are unweighted.

Implemented in theplu::yat::classifier::KNN< Distance, NeighborWeighting >, theplu::yat::classifier::NCC< Distance >, and theplu::yat::classifier::NBC.

virtual void theplu::yat::classifier::SupervisedClassifier::predict ( const MatrixLookupWeighted data,
utility::Matrix result 
) const
pure virtual

Make predictions for weighted test data.

Both data and result follow the description for predict(const MatrixLookup& data, utility::Matrix& result).

Implemented in theplu::yat::classifier::KNN< Distance, NeighborWeighting >, theplu::yat::classifier::NCC< Distance >, and theplu::yat::classifier::NBC.

virtual void theplu::yat::classifier::SupervisedClassifier::train ( const MatrixLookup data,
const Target targets 
)
pure virtual

Train the classifier using unweighted training data with known targets.

The training data data should have one column per training sample and one row for each variable measured for the training samples. The size of target should be the number of samples in data and target should contain the class for each sample ordered in the same order as columns in data.

Implemented in theplu::yat::classifier::KNN< Distance, NeighborWeighting >, theplu::yat::classifier::NCC< Distance >, and theplu::yat::classifier::NBC.

virtual void theplu::yat::classifier::SupervisedClassifier::train ( const MatrixLookupWeighted data,
const Target targets 
)
pure virtual

Train the classifier using weighted training data with known targets.

Both data and targets should follow the description for train(const MatrixLookup& data, const Target& targets).

Implemented in theplu::yat::classifier::KNN< Distance, NeighborWeighting >, theplu::yat::classifier::NCC< Distance >, and theplu::yat::classifier::NBC.


The documentation for this class was generated from the following file:

Generated on Tue Sep 26 2017 02:33:29 for yat by  doxygen 1.8.5