-
Notifications
You must be signed in to change notification settings - Fork 3
Input formats
Presently, featsel is compatible with two types of input files: the DAT and the XML formats. In the input folder of the framework, there are many examples of input files using either one of these two formats.
In the following, we will present the specifications of each of these two input file formats.
This input file format is useful for supervised learning.
Typically, the user has, for a given set S of features, a finite number of samples, each one associating a realization of S with a class label in {1,...,k}. For instance, if the user has seven samples of two features {A, B} defined in {0,1}^2, each sample associated with a label either T or F:
| Sample number | A | B | Class label |
|---|---|---|---|
| 1 | 0 | 1 | F |
| 2 | 1 | 1 | T |
| 3 | 1 | 1 | T |
| 4 | 0 | 1 | F |
| 5 | 1 | 0 | T |
| 6 | 1 | 1 | F |
| 7 | 1 | 0 | T |
The information presented in the table above can be rearranged into a histogram depicting, for each realization of the feature set, the number of occurrences that it was associated to each of the two labels:
| A | B | F | T | |
|---|---|---|---|---|
| 0 | 1 | 1 | 0 | |
| 1 | 0 | 0 | 2 | |
| 1 | 1 | 1 | 2 |
The featsel DAT format is precisely the table above without the table head:
0 1 1 0
1 0 0 2
1 1 1 2
It is noteworthy to mention that both the feature values and the number of labels do not need to be binary, just non-negative integers. For example, if we have two features, one defined in {0,1} and another one in {0,...,4}, and five labels, one possible DAT file would be:
0 4 1 1 0 0 0
1 3 1 0 2 11 2
1 2 0 0 0 0 3
0 1 2 2 0 7 10
This input file is suitable for situations in which the user wants to evaluate a feature selection algorithm from the optimization point of view. In this type of situation, we generally have a close-form expression as a cost function, which receives as argument values of features. Therefore, the XML data structure allows an easy description and documentation of the features (elements) of the set and their associated values.
For example, assume that we have a cost function with two features as argument, each one consisting in a 3-dimensional array. A possible XML to describe an input for that cost function would be:
<?xml version="1.0" encoding="UTF-8"?>
<ElementSet>
<SetName> An_alphanumeric_string </SetName>
<NumberOfElements> 2 </NumberOfElements>
<MaxNumberOfElementValues> 3 </MaxNumberOfElementValues>
<Element>
<name>A</name>
<value>1</value>
<value>2</value>
<value>1</value>
</Element>
<Element>
<name>B</name>
<value>0</value>
<value>2</value>
<value>3</value>
</Element>
</ElementSet>
where <SetName> defines the name of the set of features (must be an alphanumeric string), <NumberOfElements> declares the number of features, and <MaxNumberOfElementValues> is the maximum dimensionality of each feature.
There are cost functions with special XML tags; for example, the explicit-declared cost function has the tag <cost>. An example of this case is given in the supplementary material of the featsel paper.