NPL
Neurological Programs and Libraries
|
Base class for all ND classifiers. More...
#include <statistics.h>
Inherited by npl::ExpMax, and npl::KMeans.
Public Member Functions | |
Classifier (size_t rank) | |
Initializes the classifier. More... | |
virtual Eigen::VectorXi | classify (const Ref< const MatrixXd > samples)=0 |
Given a matrix of samples (Samples x Dims, sample on each row), apply the classifier to each sample and return a vector of the classes. More... | |
virtual size_t | classify (const Ref< const MatrixXd > samples, Ref< VectorXi > oclass)=0 |
Given a matrix of samples (Samples x Dims, sample on each row), apply the classifier to each sample and return a vector of the classes. More... | |
virtual int | update (const Ref< const MatrixXd > samples, bool reinit=false)=0 |
Updates the classifier with new samples, if reinit is true then no prior information will be used. If reinit is false then any existing information will be left intact. In Kmeans that would mean that the means will be left at their previous state. More... | |
void | compute (const Ref< const MatrixXd > samples) |
Alias for updateClasses with reinit = true. This will perform a classification scheme on all the input samples. More... | |
Public Attributes | |
const int | ndim |
Number of dimensions, must be set at construction. This is the number of columns in input samples. More... | |
int | maxit |
Maximum number of iterations. Set below 0 for infinite. More... | |
Protected Attributes | |
bool | m_valid |
Whether the classifier has been initialized yet. More... | |
Base class for all ND classifiers.
Definition at line 656 of file statistics.h.
|
inline |
Initializes the classifier.
rank | Number of dimensions of samples |
Definition at line 664 of file statistics.h.
|
pure virtual |
Given a matrix of samples (Samples x Dims, sample on each row), apply the classifier to each sample and return a vector of the classes.
samples | Set of samples, 1 per row |
Implemented in npl::ExpMax, and npl::KMeans.
|
pure virtual |
Given a matrix of samples (Samples x Dims, sample on each row), apply the classifier to each sample and return a vector of the classes.
samples | Set of samples, 1 per row |
oclass | Output classes. This vector will be resized to have the same number of rows as samples matrix. |
Implemented in npl::ExpMax, and npl::KMeans.
|
inline |
Alias for updateClasses with reinit = true. This will perform a classification scheme on all the input samples.
samples | Samples, S x D matrix with S is the number of samples and D is the dimensionality. This must match the internal dimension count. |
Definition at line 713 of file statistics.h.
|
pure virtual |
Updates the classifier with new samples, if reinit is true then no prior information will be used. If reinit is false then any existing information will be left intact. In Kmeans that would mean that the means will be left at their previous state.
samples | Samples, S x D matrix with S is the number of samples and D is the dimensionality. This must match the internal dimension count. |
reinit | whether to reinitialize the classifier before updating |
return -1 if maximum number of iterations hit, 0 otherwise (converged)
Implemented in npl::ExpMax, and npl::KMeans.
|
protected |
Whether the classifier has been initialized yet.
Definition at line 732 of file statistics.h.
int npl::Classifier::maxit |
Maximum number of iterations. Set below 0 for infinite.
Definition at line 727 of file statistics.h.
const int npl::Classifier::ndim |
Number of dimensions, must be set at construction. This is the number of columns in input samples.
Definition at line 716 of file statistics.h.