Function generateRules(std::vector<Rule>&, std::vector<int>&, DataSetFid&, Parameters&, const std::vector<std::vector<double>>&)

Function Documentation

void generateRules(std::vector<Rule> &rules, std::vector<int> &notCoveredSamples, DataSetFid &trainDataset, Parameters &p, const std::vector<std::vector<double>> &hyperlocus)

Executes the Fidex algorithm on all provided samples.

This function works in the following way:

  • Initializes the number of threads chosen by the user and splits evenly all samples to be covered between them.

  • 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 fails and the ‘covering_strategy’ is on, Fidex is computed to find a rule with the maximum possible minimal covering that can be lower than ‘min_covering’.

    -> If all attempts fail, the targeted fidelity is gradually lowered until it succeeds or ‘lowest_min_fidelity’ is reached.

    -> Each failed attempt at the lowest minimal fidelity is counted.

    -> If the max failed attempts limit is reached, the sample is removed from the not covered samples vector as it’s considered as unreachable.

  • The computed rule is added to the list of rules.

Parameters:
  • rules – Empty vector of rules to be filled once the function has finished.

  • notCoveredSamples – Vector with all samples to be covered or ignored if the algorithm isn’t able to find one in “maxFailedAttempts” attempts with a minimal covering of 1.

  • trainDataset – Class containing all usable train data to compute the algorithm.

  • p – Class containing all user-defined parameters that influence the program execution.

  • hyperlocus – 2D vector of doubles representing all the possible hyperplanes used to compute the Fidex algorithm.