Function heuristic_1(DataSetFid&, Parameters&, const std::vector<std::vector<double>>&)

Function Documentation

std::vector<Rule> heuristic_1(DataSetFid &trainDataset, Parameters &p, const std::vector<std::vector<double>> &hyperlocus)

Generates a list of rules covering all training samples using the best and slowest heuristic.

Generates rules for each training sample and filters the list of generated rules to remove duplicates and keep the rules that best fit and cover all training samples. This is performed in the following way:

  • Rules are generated for each sample.

  • Duplicated rules are removed.

  • While not all samples are covered by the rules, it checks every rule’s covered samples vector and checks how many of the not covered ones are present in it.

  • If the rule covers some samples that are not considered covered yet and covers more than the previous best rule, it’s saved as the best rule to be added to the filtered ones.

  • When all the rules are checked, the best one is removed from the rules to check, it is saved in the chosen rules vector and the samples it covers are removed from the ones that are considered not covered.

Parameters:
  • trainDataset – Class containing all usable 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.

Returns:

A vector containing the computed rules.