Attribute-Relation File Format (ARFF)

ARFF (Attribute-Relation File Format) is the file format used by WEKA, a popular machine learning toolkit. EvoAl can read and write ARFF files, making it possible to exchange data between EvoAl and WEKA.

The ARFF plugin provides three capabilities, which are often used together:

What you want to do Tools needed
Derive a DDL file from an ARFF file bin/evoal-arff-to-ddl.sh
Convert an ARFF file to a JSON, CSV or ARFF file bin/evoal-convert-arff.sh
Use an ARFF file directly in EvoAl A corresponding DDL file

The example core.arff-conversion in the examples folder of a release uses all three.

Generating a DDL File

Before EvoAl can work with your data, it needs a DDL file describing its structure (see the Data Description Language documentation). If you already have an ARFF file, EvoAl can generate a starting DDL file from it automatically by reading the ARFF file’s attribute declarations and inferring a suitable scale type for each attribute. The module is named after the relation of the ARFF file. A numeric attribute becomes cardinal real data, a nominal or string attribute nominal string data. A date or relational attribute has no DDL type, and a name that contains ' or \ cannot be a DDL name; the tool then stops with an error and writes no DDL file.

Note: The inferred scale types are estimates. Always review and adjust the generated DDL file before using it in your pipeline.

bash bin/evoal-arff-to-ddl.sh <folder> input.arff output.ddl

The tool runs in <folder>; the other paths are relative to it.

Converting an ARFF File

EvoAl’s native data format is JSON. You can convert an ARFF file to this format using the following command. The DDL file is required to correctly interpret the structure of the ARFF file during conversion: only the attributes it describes are converted. The extension of the output file selects its format: .json, .csv or .arff.

bash bin/evoal-convert-arff.sh <folder> input.arff specification.ddl output.json

A missing value (?) stays missing:

Format A missing value Values that are not missing
JSON the feature has no entry in the row 0, false, ""
CSV an empty cell (1.5,,lab) 0, false, and the quoted empty string ""
ARFF ? 0, false, ''

When EvoAl trains a model, a row with a missing value in a feature that the training uses is left out, with a warning that gives the number of such rows.

Using an ARFF File Directly

Converting your ARFF file is optional. EvoAl can read ARFF files directly wherever a JSON file would normally be expected, e.g. learning from [ "data.arff" ] in a learning task. You will still need a corresponding DDL file describing the data structure. This approach is useful when you want to avoid maintaining two copies of your data.

A numeric attribute fills a real or an integer feature (an integer feature only with whole numbers), a nominal or string attribute a string feature, and a nominal attribute with the values false and true a boolean feature.

Writing an ARFF File

Wherever EvoAl writes data to a file, a file name ending in .arff writes an ARFF file, e.g. in the conversion above. The relation is named after the file. A real or integer feature becomes a numeric attribute, a boolean feature a nominal attribute {false,true}, and a string feature a string attribute. A feature without a value is written as ?. WEKA stores a missing value as NaN, so a real value NaN is written as ? as well.