Class Hyperbox
Defined in File hyperbox.h
Class Documentation
-
class Hyperbox
Represents a hyperbox composed of discriminative hyperplanes in the feature space used to construct an explaining rule for a sample of interest, discriminating between different classes of samples.
This class encapsulates the attributes and methods needed to handle hyperboxes which include discriminative hyperplanes and the samples they cover.
Public Functions
-
explicit Hyperbox(const std::vector<std::pair<int, int>> &m_discriminativeHyperplans)
Constructs a Hyperbox object with specified discriminative hyperplanes.
- Parameters:
m_discriminativeHyperplans – Vector of (attribute index, hyperplane value) pairs representing discriminative hyperplanes.
-
void setCoveredSamples(const std::vector<int> &m_coveredSamples)
Sets the covered samples of the hyperbox.
- Parameters:
m_coveredSamples – Vector of integers representing the new covered samples.
-
std::vector<std::pair<int, int>> getDiscriminativeHyperplans() const
Gets the discriminative hyperplanes of the hyperbox.
- Returns:
Vector of (attribute index, hyperplane value) pairs representing the discriminative hyperplanes.
-
void resetDiscriminativeHyperplans()
Resets the discriminative hyperplanes of the hyperbox.
-
void computeCoveredSamples(const std::vector<int> &ancienCoveredSamples, int attribut, std::vector<std::vector<double>> &trainData, bool mainSampleGreater, double hypValue)
Computes the new covered samples with a new discriminative hyperplane.
- Parameters:
ancienCoveredSamples – Vector of previously covered sample IDs.
attribut – Index of the attribute (dimension) used for the hyperplane.
trainData – Training data matrix.
mainSampleGreater – Boolean indicating if the sample of interest is greater than the hyperplane value.
hypValue – Value of the hyperplane.
-
void computeFidelity(const int mainsamplePred, std::vector<int> &trainPreds)
Computes the fidelity of the samples covered by the hyperbox with respect to the model’s prediction.
- Parameters:
mainsamplePred – Prediction of the sample of interest.
trainPreds – Vector of predictions of the training data.
-
double getFidelity() const
Gets the fidelity of the samples covered by the hyperbox.
- Returns:
Double representing the fidelity.
-
void setFidelity(double x)
Sets the fidelity of the samples covered by the hyperbox.
- Parameters:
x – New fidelity value.
-
std::vector<int> getCoveredSamples() const
Gets the covered samples of the hyperbox.
- Returns:
Vector of integers representing the covered samples.
-
void discriminateHyperplan(int dimVal, int hypVal)
Adds a new discriminative hyperplane to the hyperbox.
- Parameters:
dimVal – Index of the attribute.
hypVal – Hyperplane value.
-
explicit Hyperbox(const std::vector<std::pair<int, int>> &m_discriminativeHyperplans)