Class Hyperspace
Defined in File hyperspace.h
Class Documentation
-
class Hyperspace
Represents a hyperspace composed of all the possible hyperplanes in this space and that manages a hyperbox and its associated discriminative hyperplanes.
This class encapsulates the attributes and methods needed to handle a hyperspace which includes a hyperbox and the possible hyperplanes in the feature space that discriminate between different classes of samples.
Public Functions
-
Hyperspace()
Default constructor for Hyperspace.
-
explicit Hyperspace(const std::vector<std::vector<double>> &matHypLocus)
Constructs a Hyperspace object with a specified matrix of possible hyperplanes.
Constructs a Hyperspace object with a specified 2D vector of doubles of possible hyperplanes.
- Parameters:
matHypLocus – 2D vector of doubles representing all the possible hyperplanes.
-
std::shared_ptr<Hyperbox> getHyperbox() const
Gets the hyperbox associated with the hyperspace.
- Returns:
Shared pointer to the Hyperbox object.
-
std::vector<std::vector<double>> getHyperLocus() const
Gets the matrix of possible hyperplanes in the hyperspace.
Gets the 2D vector of doubles of possible hyperplanes in the hyperspace.
- Returns:
2D vector of doubles representing all the possible hyperplanes.
-
Rule ruleExtraction(std::vector<double> &mainSampleData, const int mainSamplePred, double ruleAccuracy, double ruleConfidence, const std::vector<double> &mus = std::vector<double>(), const std::vector<double> &sigmas = std::vector<double>(), const std::vector<int> &normalizationIndices = std::vector<int>())
Extracts a rule from the hyperspace based on the main sample data and its prediction.
- Parameters:
mainSampleData – Data of the main sample.
mainSamplePred – Prediction of the main sample.
ruleAccuracy – Accuracy of the rule.
ruleConfidence – Confidence of the rule.
mus – Means for the denormalization of the rule values (optional).
sigmas – Standard deviations for the denormalization of the rule values (optional).
normalizationIndices – Indices for the denormalization of the rule values (optional).
- Returns:
A Rule object representing the extracted rule.
-
double computeRuleAccuracy(std::vector<int> &trainPreds, std::vector<int> &trainTrueClass, bool hasTrueClasses, bool mainSampleCorrect = false) const
Computes the accuracy of the rule with respect to the training predictions and true classes of the covered samples.
- Parameters:
trainPreds – Predictions of the training data.
trainTrueClass – True classes of the training data.
hasTrueClasses – Boolean indicating if true classes are available.
mainSampleCorrect – Boolean indicating if the main sample is correctly classified.
- Returns:
The accuracy of the rule.
-
double computeRuleConfidence(std::vector<std::vector<double>> &trainOutputValuesPredictions, const int mainSamplePred, double mainSamplePredValue = -1.0) const
Computes the confidence of the rule with respect to the main sample prediction and training output values of the covered samples.
- Parameters:
trainOutputValuesPredictions – Output values of the training data predictions.
rulePred – Prediction of the rule.
mainSamplePredValueOnRulePred – Output value of the main sample prediction (optional).
- Returns:
The confidence of the rule.
-
Hyperspace()