November 2018
Intermediate to advanced
300 pages
7h 42m
English
We will load the data to Weka directly from the .csv format. For this purpose, we will write a function that accepts the path to the data file and the true labels file. The function will load and merge both datasets and remove empty attributes. We will begin with the following code block:
public static Instances loadData(String pathData, String pathLabeles) throws Exception {
First, we load the data using the CSVLoader() class. Additionally, we specify the \t tab as a field separator and force the last 40 attributes to be parsed as nominal:
// Load data CSVLoader loader = new CSVLoader(); loader.setFieldSeparator("\t"); loader.setNominalAttributes("191-last"); loader.setSource(new File(pathData)); Instances data = loader.getDataSet(); ...