# BoostAODE Algorithm Operation

## Algorithm

## Hyperparameters

The hyperparameters defined in the algorithm are:

- ***bisection*** (*boolean*): If set to true allows the algorithm to add *k* models at once (as specified in the algorithm) to the ensemble. Default value: *false*.

- ***order*** (*{"asc", "desc", "rand"}*): Sets the order (ascending/descending/random) in which dataset variables will be processed to choose the parents of the *SPODEs*. Default value: *"desc"*.

- ***convergence*** (*boolean*): Sets whether the convergence of the result will be used as a termination condition. If this hyperparameter is set to true, the training dataset passed to the model is divided into two sets, one serving as training data and the other as a test set (so the original test partition will become a validation partition in this case). The partition is made by taking the first partition generated by a process of generating a 5 fold partition with stratification using a predetermined seed. The exit condition used in this *convergence* is that the difference between the accuracy obtained by the current model and that obtained by the previous model is greater than *1e-4*; otherwise, one will be added to the number of models that worsen the result (see next hyperparameter). Default value: *false*.

- ***maxTolerance*** (*int*): Sets the maximum number of models that can worsen the result without constituting a termination condition. Default value: *1*. if ***bisection*** is set to *true*, the value of this hyperparameter will be exponent of base 2 to compute the number of models to insert at once.

- ***select_features*** (*{"IWSS", "FCBF", "CFS", ""}*): Selects the variable selection method to be used to build initial models for the ensemble that will be included without considering any of the other exit conditions. Once the models of the selected variables are built, the algorithm will update the weights using the ensemble and set the significance of all the models built with the same &alpha;<sub>t</sub>. Default value: *""*.

- ***threshold*** (*double*): Sets the necessary value for the IWSS and FCBF algorithms to function. Accepted values are:
  - IWSS: $threshold \in [0, 0.5]$
  - FCBF: $threshold \in [10^{-7}, 1]$

  Default value is *-1* so every time any of those algorithms are called, the threshold has to be set to the desired value.

- ***predict_voting*** (*boolean*): Sets whether the algorithm will use *model voting* to predict the result. If set to false, the weighted average of the probabilities of each model's prediction will be used. Default value: *false*.

## Operation

The algorithm performs the following steps:

1. **Initialization**

    - If ***select_features*** is set, as many *SPODEs* are created as variables selected by the corresponding feature selection algorithm, and these variables are marked as used.

    - Initial weights of the examples are set to *1/m*.

1. **Main Training Loop:**

   - Variables are sorted by mutual information order with the class variable and processed in ascending, descending or random order, according to the value of the *order* hyperparameter. If it is random, the variables are shuffled.

   - If the parent repetition is not established, the variable is marked as used.

   - A *SPODE* is created using the selected variable as the parent.

   - The model is trained, and the class variable corresponding to the training dataset is calculated. The calculation can be done using the last trained model or the set of models trained up to that point, according to the value of the *predict_single* hyperparameter.

   - The weights associated with the examples are updated using this expression:

     - w<sub>i</sub> · e<sup>&alpha;<sub>t</sub></sup> (if the example has been misclassified)

     - w<sub>i</sub> · e<sup>-&alpha;<sub>t</sub></sup> (if the example has been correctly classified)

   - The model significance is set to &alpha;<sub>t</sub>.

   - If the ***convergence*** hyperparameter is set, the accuracy value on the test dataset that we separated in an initial step is calculated.

1. **Exit Conditions:**

   - &epsilon;<sub>t</sub> > 0.5 => misclassified examples are penalized.

   - Number of models with worse accuracy greater than ***tolerance*** and ***convergence*** established.

   - There are no more variables to create models, and ***repeatSparent*** is not set.

   - Number of models > ***maxModels*** if ***repeatSparent*** is set.

### [Proposal for *predict_single = false*](./BoostAODE_train_predict.pdf)
