Example 40: Exhaustive (optimal) feature selection. More...
#include <boost/smart_ptr.hpp>
#include <exception>
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include "error.hpp"
#include "global.hpp"
#include "subset.hpp"
#include "data_intervaller.hpp"
#include "data_splitter.hpp"
#include "data_splitter_5050.hpp"
#include "data_splitter_cv.hpp"
#include "data_scaler.hpp"
#include "data_scaler_void.hpp"
#include "data_accessor_splitting_memTRN.hpp"
#include "data_accessor_splitting_memARFF.hpp"
#include "criterion_wrapper.hpp"
#include "distance_Lp.hpp"
#include "classifier_knn.hpp"
#include "search_exhaustive.hpp"
#include "result_tracker_dupless.hpp"
Functions | |
int | main () |
Example 40: Exhaustive (optimal) feature selection.
int main | ( | ) |
Selects features exhaustively, i.e., evaluates all possible feature combinations. This approach is guaranteed to find optimum with respect to the chosen criterion, but its exponential time complexity renders it prohibitive for even moderately dimensioned tasks. Here it is demonstrated on 15-dimensional data with 3-NN (based on L1.5 distance) wrapper classification accuracy as FS criterion - note how time consuming the computation is even for relatively low-dimensional case. Classification accuracy (i.e, FS wrapper criterion value) is estimated on the first 50% of data samples by means of 3-fold cross-validation. The final classification performance on the selected subspace is eventually validated on the second 50% of data. Exhaustive search is called here in d-optimizing setting, invoked by parameter 0 in search(0,...), which is otherwise used to specify the required subset size. Optional result tracking is employed here to reveal duplicate solutions yielding the same maximum criterion value (see also Example 60: Detecting alternative feature selection results with equal criterion value.).
References FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >::enable_result_tracking(), FST::Search_Exhaustive< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >::search(), and FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION >::set_output_detail().