File partition_single.hpp¶
-
class SinglePartition : public IPartition¶
- #include <partition_single.hpp>
An implementation of the class
IPartitionthat provides random access to the indices of elements that are included in a single set.Public Types
-
using const_iterator = IndexIterator¶
An iterator that provides read-only access to the indices of the elements that are included in the partition.
Public Functions
-
SinglePartition(uint32 numElements)¶
- Parameters:
numElements – The number of elements to be included in the partition. Must be at least 1
-
const_iterator cbegin() const¶
Returns a
const_iteratorto the beginning of the indices that are contained in the partition.- Returns:
A
const_iteratorto the beginning
-
const_iterator cend() const¶
Returns a
const_iteratorto the end of the indices that are contained in the partition.- Returns:
A
const_iteratorto the end
-
uint32 getNumElements() const¶
Returns the number of elements that are contained in the partition.
- Returns:
The number of elements
-
virtual std::unique_ptr<IStoppingCriterion> createStoppingCriterion(const IStoppingCriterionFactory &factory) override¶
Creates and returns a new instance of the class
IStoppingCriterion, based on the type of this partition.- Parameters:
factory – A reference to an object of type
IStoppingCriterionFactorythat should be used to create the instance- Returns:
An unique pointer to an object of type
IStoppingCriterionthat has been created
-
virtual std::unique_ptr<IInstanceSampling> createInstanceSampling(const IClassificationInstanceSamplingFactory &factory, const IRowWiseLabelMatrix &labelMatrix, IStatistics &statistics, const EqualWeightVector &exampleWeights) override¶
Creates and returns a new instance of the class
IInstanceSamplingthat can be used in classification problems, based on the type of this partition.- Parameters:
factory – A reference to an object of type
IClassificationInstanceSamplingFactorythat should be used to create the instancelabelMatrix – A reference to an object of type
IRowWiseLabelMatrixthat provides row-wise access to the labels of individual training examplesstatistics – A reference to an object of type
IStatisticsthat provides access to the statistics which serve as a basis for learning rulesexampleWeights – A reference to an object of type
EqualWeightVectorthat provides access to the weights of individual training examples
- Returns:
An unique pointer to an object of type
IInstanceSamplingthat has been created
-
virtual std::unique_ptr<IInstanceSampling> createInstanceSampling(const IClassificationInstanceSamplingFactory &factory, const IRowWiseLabelMatrix &labelMatrix, IStatistics &statistics, const DenseWeightVector<float32> &exampleWeights) override¶
Creates and returns a new instance of the class
IInstanceSamplingthat can be used in classification problems, based on the type of this partition.- Parameters:
factory – A reference to an object of type
IClassificationInstanceSamplingFactorythat should be used to create the instancelabelMatrix – A reference to an object of type
IRowWiseLabelMatrixthat provides row-wise access to the labels of individual training examplesstatistics – A reference to an object of type
IStatisticsthat provides access to the statistics which serve as a basis for learning rulesexampleWeights – A reference to an object of type
DenseWeightVector<float32>that provides access to the weights of individual training examples
- Returns:
An unique pointer to an object of type
IInstanceSamplingthat has been created
-
virtual std::unique_ptr<IInstanceSampling> createInstanceSampling(const IRegressionInstanceSamplingFactory &factory, const IRowWiseRegressionMatrix ®ressionMatrix, IStatistics &statistics, const EqualWeightVector &exampleWeights) override¶
Creates and returns a new instance of the class
IInstanceSamplingthat can be used in regression problems, based on the type of this partition.- Parameters:
factory – A reference to an object of type
IRegressionInstanceSamplingFactorythat should be used to create the instanceregressionMatrix – A reference to an object of type
IRowWiseRegressionMatrixthat provides row-wise access to the regression scores of individual training examplesstatistics – A reference to an object of type
IStatisticsthat provides access to the statistics which serve as a basis for learning rulesexampleWeights – A reference to an object of type
EqualWeightVectorthat provides access to the weights of individual training examples
- Returns:
An unique pointer to an object of type
IInstanceSamplingthat has been created
-
virtual std::unique_ptr<IInstanceSampling> createInstanceSampling(const IRegressionInstanceSamplingFactory &factory, const IRowWiseRegressionMatrix ®ressionMatrix, IStatistics &statistics, const DenseWeightVector<float32> &exampleWeights) override¶
Creates and returns a new instance of the class
IInstanceSamplingthat can be used in regression problems, based on the type of this partition.- Parameters:
factory – A reference to an object of type
IRegressionInstanceSamplingFactorythat should be used to create the instanceregressionMatrix – A reference to an object of type
IRowWiseRegressionMatrixthat provides row-wise access to the regression scores of individual training examplesstatistics – A reference to an object of type
IStatisticsthat provides access to the statistics which serve as a basis for learning rulesexampleWeights – A reference to an object of type
DenseWeightVector<float64>that provides access to the weights of individual training examples
- Returns:
An unique pointer to an object of type
IInstanceSamplingthat has been created
-
virtual Quality evaluateOutOfSample(const IFeatureSubspace &featureSubspace, const CoverageMask &coverageMask, const IPrediction &head) override¶
Calculates and returns a numerical score that assesses the quality of a rule’s prediction for all examples that do not belong to the current sample and are marked as covered according to a given object of type
CoverageMask.- Parameters:
featureSubspace – A reference to an object of type
IFeatureSubspacethat should be used to evaluate the predictioncoverageMask – A reference to an object of type
CoverageMaskthat keeps track of the examples that are covered by the rulehead – A reference to an object of type
IPredictionthat stores the scores that are predicted by the rule
- Returns:
An object of type
Qualitythat stores the calculated quality
-
virtual void recalculatePrediction(const IFeatureSubspace &featureSubspace, const CoverageMask &coverageMask, std::unique_ptr<IEvaluatedPrediction> &headPtr) override¶
Recalculates and updates a rule’s prediction based on all examples in the training set that are marked as covered according to a given object of type
CoverageMask.- Parameters:
featureSubspace – A reference to an object of type
IFeatureSubspacethat should be used to recalculate the predictioncoverageMask – A reference to an object of type
CoverageMaskthat keeps track of the examples that are covered by the ruleheadPtr – A reference to an unique pointer that stores an object of type
IEvaluatedPredictionto be updated
-
virtual std::unique_ptr<IMarginalProbabilityCalibrationModel> fitMarginalProbabilityCalibrationModel(const IMarginalProbabilityCalibrator &probabilityCalibrator, const IRowWiseLabelMatrix &labelMatrix, const IStatistics &statistics) override¶
Fits and returns a model for the calibration of marginal probabilities, based on the type of this partition.
- Parameters:
probabilityCalibrator – A reference to an object of type
IMarginalProbabilityCalibratorthat should be used to fit the calibration modellabelMatrix – A reference to an object of type
IRowWiseLabelMatrixthat provides row-wise access to the labels of the training examplesstatistics – A reference to an object of type
IStatisticsthat provides access to statistics about the quality of predictions for training examples
- Returns:
An unique pointer to an object of type
IMarginalProbabilityCalibrationModelthat has been fit
-
virtual std::unique_ptr<IJointProbabilityCalibrationModel> fitJointProbabilityCalibrationModel(const IJointProbabilityCalibrator &probabilityCalibrator, const IRowWiseLabelMatrix &labelMatrix, const IStatistics &statistics) override¶
Fits and returns a model for the calibration of joint probabilities, based on the type of this partition.
- Parameters:
probabilityCalibrator – A reference to an object of type
IJointProbabilityCalibratorthat should be used to fit the calibration modellabelMatrix – A reference to an object of type
IRowWiseLabelMatrixthat provides row-wise access to the labels of the training examplesstatistics – A reference to an object of type
IStatisticsthat provides access to statistics about the quality of predictions for training examples
- Returns:
An unique pointer to an object of type
IJointProbabilityCalibrationModelthat has been fit
-
using const_iterator = IndexIterator¶