# Using HappyFeat

## Feature Selection & Training the Classifier (right panel)

This step allows to train the classification algorithm, using sub-sets of sensors and frequencies.  

First, select the relevant sensor/frequency pair(s):

  - Use this format: `Electrode;Frequency` separated with a semicolon (`;`). Example: **`C4;13`**
  - A frequency range can be entered, using a colon symbol(`:`) as such: `C4;13:16`
  - If you want to use more than one feature, click `Add Feature` to add a field. 
  - You can remove the last field using `Remove Last Feat`
  - *Note: If you have setup your workspace to allow for using two metrics, you can choose to use training features for only one of the metrics or for both metrics* 

The number of k-fold partitions to use for the training step can be set. Trials used for training will be segmented using this number of partitions.

The list of runs available for training is updated with runs which have undergone feature extraction in this *session* (see paragraph on *sessions* in [workspaces](workspaces.md))

Select the run(s) you want to use for training in the list. Trials from all selected runs are considered ("concatenated") for the following training attempt.

Click on "Train classifier". After processing, a detailed report of accuracies is provided in a pop-up window, and a shorter summary is made available in the bottom part of this panel.
Results from all training attempts of the current *session* are listed.

This process can be run *as many times as needed*. Every time it is run, the scenario for the Online/Testing (`sc3-online.xml`) part of the experiment will be updated with selected features and computed classifier weights. 

!!! warning
    The online scenario (`sc3-online.xml`) is updated with the features & weights from the **last** training attempt, not necessarily the best one! To make sure it contains the features/weights you want, you need to re-run a training attempt with those.
  
For a given *session*, each training attempt is numbered, and the computed classifier weights can be found in `<happyfeat_install>/<currentWorkspace>/sessions/<sessionNb>/train/classifier-weights-<nb>.xml` 