GClasses
|
BAG stands for bootstrap aggregator. It represents an ensemble of voting modelers. Each model is trained with a slightly different training set, which is produced by drawing randomly from the original training set with replacement until we have a new training set of the same size. Each model is given equal weight in the vote. More...
#include <GEnsemble.h>
Public Member Functions | |
GBag (GRand &rand) | |
General-purpose constructor. | |
GBag (GDomNode *pNode, GLearnerLoader &ll) | |
Deserializing constructor. | |
virtual | ~GBag () |
virtual GDomNode * | serialize (GDom *pDoc) |
Marshal this object into a DOM, which can then be converted to a variety of serial formats. | |
virtual void | clear () |
Calls clears on all of the learners, but does not delete them. | |
void | flush () |
Removes and deletes all the learners. | |
void | addLearner (GSupervisedLearner *pLearner) |
Adds a learner to the bag. This takes ownership of pLearner (so it will delete it when it's done with it) | |
void | setProgressCallback (EnsembleProgressCallback pCB, void *pThis) |
If you want to be notified when another instance begins training, you can set this callback. | |
Static Public Member Functions | |
static void | test () |
Runs some unit tests related to supervised learning. Throws an exception if any problems are found. | |
Protected Member Functions | |
virtual void | trainInnerInner (GMatrix &features, GMatrix &labels) |
See the comment for GEnsemble::trainInnerInner. | |
virtual void | determineWeights (GMatrix &features, GMatrix &labels) |
Assigns uniform weight to all models. (This method is deliberately virtual so that you can overload it if you want non-uniform weighting.) | |
Protected Attributes | |
EnsembleProgressCallback | m_pCB |
void * | m_pThis |
double | m_trainSize |
BAG stands for bootstrap aggregator. It represents an ensemble of voting modelers. Each model is trained with a slightly different training set, which is produced by drawing randomly from the original training set with replacement until we have a new training set of the same size. Each model is given equal weight in the vote.
GClasses::GBag::GBag | ( | GRand & | rand | ) |
General-purpose constructor.
GClasses::GBag::GBag | ( | GDomNode * | pNode, |
GLearnerLoader & | ll | ||
) |
Deserializing constructor.
virtual GClasses::GBag::~GBag | ( | ) | [virtual] |
void GClasses::GBag::addLearner | ( | GSupervisedLearner * | pLearner | ) |
Adds a learner to the bag. This takes ownership of pLearner (so it will delete it when it's done with it)
virtual void GClasses::GBag::clear | ( | ) | [virtual] |
Calls clears on all of the learners, but does not delete them.
Implements GClasses::GSupervisedLearner.
virtual void GClasses::GBag::determineWeights | ( | GMatrix & | features, |
GMatrix & | labels | ||
) | [protected, virtual] |
Assigns uniform weight to all models. (This method is deliberately virtual so that you can overload it if you want non-uniform weighting.)
Reimplemented in GClasses::GBayesianModelAveraging, and GClasses::GBayesianModelCombination.
void GClasses::GBag::flush | ( | ) |
Removes and deletes all the learners.
Marshal this object into a DOM, which can then be converted to a variety of serial formats.
Implements GClasses::GSupervisedLearner.
Reimplemented in GClasses::GBayesianModelAveraging, and GClasses::GBayesianModelCombination.
void GClasses::GBag::setProgressCallback | ( | EnsembleProgressCallback | pCB, |
void * | pThis | ||
) | [inline] |
If you want to be notified when another instance begins training, you can set this callback.
static void GClasses::GBag::test | ( | ) | [static] |
Runs some unit tests related to supervised learning. Throws an exception if any problems are found.
Reimplemented from GClasses::GSupervisedLearner.
virtual void GClasses::GBag::trainInnerInner | ( | GMatrix & | features, |
GMatrix & | labels | ||
) | [protected, virtual] |
See the comment for GEnsemble::trainInnerInner.
Implements GClasses::GEnsemble.
EnsembleProgressCallback GClasses::GBag::m_pCB [protected] |
void* GClasses::GBag::m_pThis [protected] |
double GClasses::GBag::m_trainSize [protected] |