Class Fidex
Defined in File fidexAlgo.h
Nested Relationships
Nested Types
Class Documentation
-
class Fidex
Class to implement the Fidex algorithm for rule extraction.
Fidex is an algorithm designed to extract a rule that explains the decisions of a machine learning model on a specific sample. It works by identifying hyperplanes in the feature space that discriminate between different classes of samples and constructing a rule based on these hyperplanes.
Public Functions
-
Fidex(DataSetFid &_trainDataset, Parameters ¶meters, Hyperspace &Hyperspace, bool usingTestSamples)
Constructs a Fidex object with the given training dataset, parameters, and hyperspace and sets the random seed.
- Parameters:
trainDataset – Reference to the training dataset.
parameters – Reference to the parameters object.
hyperspace – Reference to the hyperspace.
usingTestSamples – Boolean indicating whether test samples are being used.
-
bool compute(Rule &rule, std::vector<double> &mainSampleValues, int mainSamplePred, double minFidelity, int minNbCover, int mainSampleClass = -1)
Executes the Fidex algorithm to compute an explaining rule for the given sample based on the training samples and hyperlocus and directed by the given parameters.
Fidex builds a rule that meets the specified fidelity and covering criteria. It is driven by a few other parameters, including dropout and the maximum number of iterations allowed. It works by identifying hyperplanes in the feature space that discriminate between different classes of samples and constructing a rule based on these hyperplanes. It updates the provided rule object with the computed rule if successful.
- Parameters:
rule – Reference to the Rule object to be updated by the computation.
mainSampleValues – A vector of double values representing the main sample values.
mainSamplePred – An integer representing the predicted class of the main sample.
minFidelity – A double representing the minimum fidelity threshold for rule creation.
minNbCover – An integer representing the minimum number of samples a rule must cover.
mainSampleClass – An integer representing the class of the main sample. Default is -1.
- Returns:
True if a rule meeting the criteria is successfully computed.
- Returns:
False if no rule meeting the criteria can be computed.
-
inline void setShowInitialFidelity(bool value)
Sets the flag to show the initial fidelity.
- Parameters:
value – Boolean value to set the flag.
-
inline void setMainSamplePredValue(double value)
Sets the predicted value of the main sample.
- Parameters:
value – Double value representing the predicted value.
-
inline void setNbIt(int value)
Sets the number of iterations of the algorithm.
- Parameters:
value – Integer value representing the number of iterations.
-
inline bool getShowInitialFidelity() const
Gets the flag indicating whether to show the initial fidelity.
- Returns:
Boolean value indicating the flag state.
-
inline double getMainSamplePredValue() const
Gets the predicted value of the main sample.
- Returns:
Double value representing the predicted value.
-
inline int getNbIt() const
Gets the number of iterations of the algorithm.
- Returns:
Integer value representing the number of iterations.
-
bool launchFidex(Rule &rule, std::vector<double> &mainSampleValues, int mainSamplePred, int mainSampleClass, bool verbose = false)
Launches the Fidex algorithm with specified parameters to attempt creating a rule for the given sample that meets given minimum covering and minimum fidelity criteria.
Fidex is based on the training samples and hyperlocus and directed by the given parameters, including dropout and the maximum number of iterations allowed. It works by identifying hyperplanes in the feature space that discriminate between different classes of samples and constructing a rule based on these hyperplanes.
Computes Fidex until a rule is created or until the max failed attempts limit is reached.
First attempt to generate a rule with a covering greater or equal to ‘min_covering’ and a fidelity greater or equal to ‘min_fidelity’.
If the attempt failed and the ‘covering_strategy’ is on, Fidex is computed to find a rule with the max possible minimal covering that can be lower than ‘min_covering’.
If all attempts failed, the targeted fidelity is gradually lowered until it succeed or ‘lowest_min_fidelity’ is reached.
Each failed attempt on lowest minimal fidelity are counted.
If the max failed attempts limit is reached, then the rule couldn’t be computed for this sample.
- Parameters:
rule – Reference to the Rule object to be potentially updated by the computation.
mainSampleValues – A vector of double values representing the main sample values.
mainSamplePred – An integer representing the predicted class of the main sample.
mainSampleClass – An integer representing the class of the main sample.
verbose – A boolean flag for detailed verbose output. Default is false.
- Returns:
True if a rule meeting the criteria is successfully computed.
- Returns:
False if no rule meeting the criteria can be computed.
-
struct currentExecutionSpecs
Structure to handle some parameters of the current execution.
-
Fidex(DataSetFid &_trainDataset, Parameters ¶meters, Hyperspace &Hyperspace, bool usingTestSamples)