Random Forest Classifier. More...
#include <shark/Models/Trees/RFClassifier.h>
Public Member Functions | |
std::string | name () const |
From INameable: return the class name. More... | |
void | computeOOBerror () |
void | computeFeatureImportances () |
double const | OOBerror () const |
RealVector const & | featureImportances () const |
UIntVector | countAttributes () const |
void | setLabelDimension (std::size_t in) |
Set the dimension of the labels. More... | |
void | setInputDimension (std::size_t in) |
ForestInfo | getForestInfo () const |
void | setForestInfo (ForestInfo const &finfo, std::vector< double > const &weights=std::vector< double >()) |
![]() | |
MeanModel () | |
Constructor. More... | |
std::string | name () const |
returns the name of the object More... | |
void | eval (typename base_type::BatchInputType const &patterns, typename base_type::BatchOutputType &outputs) const |
void | eval (typename base_type::BatchInputType const &patterns, typename base_type::BatchOutputType &outputs, State &state) const |
RealVector | parameterVector () const |
This model does not have any parameters. More... | |
void | setParameterVector (const RealVector ¶m) |
This model does not have any parameters. More... | |
void | read (InArchive &archive) |
From ISerializable, reads a model from an archive. More... | |
void | write (OutArchive &archive) const |
writes a model to an archive More... | |
void | clearModels () |
Removes all models from the ensemble. More... | |
void | addModel (CARTClassifier< RealVector > const &model, double weight=1.0) |
Adds a new model to the ensemble. More... | |
double const & | weight (std::size_t i) const |
Returns the weight of the i-th model. More... | |
void | setWeight (std::size_t i, double newWeight) |
sets the weight of the i-th model More... | |
std::size_t | numberOfModels () const |
Returns the number of models. More... | |
![]() | |
AbstractModel () | |
virtual | ~AbstractModel () |
const Features & | features () const |
virtual void | updateFeatures () |
bool | hasFirstParameterDerivative () const |
Returns true when the first parameter derivative is implemented. More... | |
bool | hasSecondParameterDerivative () const |
Returns true when the second parameter derivative is implemented. More... | |
bool | hasFirstInputDerivative () const |
Returns true when the first input derivative is implemented. More... | |
bool | hasSecondInputDerivative () const |
Returns true when the second parameter derivative is implemented. More... | |
bool | isSequential () const |
virtual boost::shared_ptr< State > | createState () const |
Creates an internal state of the model. More... | |
virtual void | eval (BatchInputType const &patterns, BatchOutputType &outputs) const |
Standard interface for evaluating the response of the model to a batch of patterns. More... | |
virtual void | eval (BatchInputType const &patterns, BatchOutputType &outputs, State &state) const=0 |
Standard interface for evaluating the response of the model to a batch of patterns. More... | |
virtual void | eval (InputType const &pattern, OutputType &output) const |
Standard interface for evaluating the response of the model to a single pattern. More... | |
Data< OutputType > | operator() (Data< InputType > const &patterns) const |
Model evaluation as an operator for a whole dataset. This is a convenience function. More... | |
OutputType | operator() (InputType const &pattern) const |
Model evaluation as an operator for a single pattern. This is a convenience function. More... | |
BatchOutputType | operator() (BatchInputType const &patterns) const |
Model evaluation as an operator for a single pattern. This is a convenience function. More... | |
virtual void | weightedParameterDerivative (BatchInputType const &pattern, BatchOutputType const &coefficients, State const &state, RealVector &derivative) const |
calculates the weighted sum of derivatives w.r.t the parameters. More... | |
virtual void | weightedParameterDerivative (BatchInputType const &pattern, BatchOutputType const &coefficients, Batch< RealMatrix >::type const &errorHessian, State const &state, RealVector &derivative, RealMatrix &hessian) const |
calculates the weighted sum of derivatives w.r.t the parameters More... | |
virtual void | weightedInputDerivative (BatchInputType const &pattern, BatchOutputType const &coefficients, State const &state, BatchInputType &derivative) const |
calculates the weighted sum of derivatives w.r.t the inputs More... | |
virtual void | weightedInputDerivative (BatchInputType const &pattern, BatchOutputType const &coefficients, typename Batch< RealMatrix >::type const &errorHessian, State const &state, RealMatrix &derivative, Batch< RealMatrix >::type &hessian) const |
calculates the weighted sum of derivatives w.r.t the inputs More... | |
virtual void | weightedDerivatives (BatchInputType const &patterns, BatchOutputType const &coefficients, State const &state, RealVector ¶meterDerivative, BatchInputType &inputDerivative) const |
calculates weighted input and parameter derivative at the same time More... | |
![]() | |
virtual | ~IParameterizable () |
virtual std::size_t | numberOfParameters () const |
Return the number of parameters. More... | |
![]() | |
virtual | ~INameable () |
![]() | |
virtual | ~ISerializable () |
Virtual d'tor. More... | |
void | load (InArchive &archive, unsigned int version) |
Versioned loading of components, calls read(...). More... | |
void | save (OutArchive &archive, unsigned int version) const |
Versioned storing of components, calls write(...). More... | |
BOOST_SERIALIZATION_SPLIT_MEMBER () | |
Protected Attributes | |
std::size_t | m_labelDimension |
std::size_t | m_inputDimension |
double | m_OOBerror |
RealVector | m_featureImportances |
![]() | |
std::vector< CARTClassifier< RealVector > > | m_models |
collection of models. More... | |
std::vector< double > | m_weight |
Weight of the mean. More... | |
double | m_weightSum |
Total sum of weights. More... | |
![]() | |
Features | m_features |
Additional Inherited Members | |
![]() | |
enum | Feature |
typedef CARTClassifier< RealVector > ::InputType | InputType |
Defines the input type of the model. More... | |
typedef CARTClassifier< RealVector > ::OutputType | OutputType |
Defines the output type of the model. More... | |
typedef Batch< InputType >::type | BatchInputType |
defines the batch type of the input type. More... | |
typedef Batch< OutputType >::type | BatchOutputType |
defines the batch type of the output type More... | |
typedef TypedFlags< Feature > | Features |
typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Random Forest Classifier.
Definition at line 58 of file RFClassifier.h.
|
inline |
Definition at line 76 of file RFClassifier.h.
References m_featureImportances, m_inputDimension, shark::MeanModel< CARTClassifier< RealVector > >::m_models, and shark::MeanModel< CARTClassifier< RealVector > >::numberOfModels().
|
inline |
Definition at line 66 of file RFClassifier.h.
References shark::MeanModel< CARTClassifier< RealVector > >::m_models, m_OOBerror, and shark::MeanModel< CARTClassifier< RealVector > >::numberOfModels().
|
inline |
Definition at line 99 of file RFClassifier.h.
References shark::MeanModel< CARTClassifier< RealVector > >::m_models, and shark::blas::noalias().
|
inline |
Definition at line 94 of file RFClassifier.h.
References m_featureImportances.
|
inline |
Definition at line 119 of file RFClassifier.h.
References shark::MeanModel< CARTClassifier< RealVector > >::m_models.
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Definition at line 62 of file RFClassifier.h.
|
inline |
Definition at line 89 of file RFClassifier.h.
References m_OOBerror.
|
inline |
Definition at line 126 of file RFClassifier.h.
References shark::MeanModel< CARTClassifier< RealVector > >::m_models, shark::MeanModel< CARTClassifier< RealVector > >::m_weight, shark::MeanModel< CARTClassifier< RealVector > >::m_weightSum, and SHARKEXCEPTION.
|
inline |
Definition at line 115 of file RFClassifier.h.
References m_inputDimension.
|
inline |
Set the dimension of the labels.
Definition at line 110 of file RFClassifier.h.
References m_labelDimension.
|
protected |
Definition at line 153 of file RFClassifier.h.
Referenced by computeFeatureImportances(), and featureImportances().
|
protected |
Definition at line 147 of file RFClassifier.h.
Referenced by computeFeatureImportances(), and setInputDimension().
|
protected |
Definition at line 144 of file RFClassifier.h.
Referenced by setLabelDimension().
|
protected |
Definition at line 150 of file RFClassifier.h.
Referenced by computeOOBerror(), and OOBerror().