machine learning – Java Weka setClassValue classifying numbers instead of illness

I’m working on a school project to classify, bases on antibody data, what type of illness someone has. I’m using the Weka API to load in a .model file I created while running Weka and then I try to run it on a file the user will input. The problem is that, instead of classifying the illness someone has, it is classifying a number.

import weka.classifiers.AbstractClassifier;
import weka.classifiers.bayes.NaiveBayes;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.converters.ConverterUtils.DataSource;
import weka.core.pmml.jaxbbindings.NaiveBayesModel;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Wrapper {
    private final String wekaFile = "testdata/naivebayes_model.model";

    public static void main(String() args) {
        Wrapper runWeka = new Wrapper();
        String unknownFile = "data.csv";
        runWeka.start(unknownFile);
    }

    private void start(String unknownFile) {
        String datafile = "locatie.arff";

        try {
            // Modifying data by using an Rscript
            modifyData(unknownFile);
            Instances instances = loadData();
            printInstances(instances);
            AbstractClassifier classifier = loadClassifier();
            classifyNewInstance(classifier, instances);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void modifyData(String unknownFile) throws IOException, InterruptedException {
        System.out.println("HERE");
        ProcessBuilder pb = new ProcessBuilder("Rscript", "./src/main/resources/R_script.R",
                "./src/main/resources/dummy");
        pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
        pb.redirectError(ProcessBuilder.Redirect.INHERIT);
        Process p = pb.start();

        BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String readline;
        int i = 0;
        while ((readline = reader.readLine()) != null) {
            System.out.println(++i + " " + readline);
        }

        System.out.println("DONE");
    }

    private void printInstances(Instances instances) {
        int numAttributes = instances.numAttributes();

        for (int i =0; i < numAttributes; i++) {
            System.out.println("Attribute: " + i + " = " + instances.attribute(i));
        }
    }

    private void classifyNewInstance(AbstractClassifier classifier, Instances instances) throws Exception {
        // creating copy
        Instances labeled = new Instances(instances);
        // label instances
        for (int i = 0; i < instances.numInstances(); i++) {
            double clsLabel = classifier.classifyInstance(instances.instance(i));
            System.out.println(labeled.instance(i));
            labeled.instance(i).setClassValue(clsLabel);
        }
        System.out.println("nNew, labeled = n" + labeled);
    }


    private AbstractClassifier loadClassifier() throws Exception {
        return (AbstractClassifier) weka.core.SerializationHelper.read(wekaFile);
    }

    private Instances loadData() throws IOException {
        try {
            DataSource source = new DataSource("./src/main/resources/data.arff");
            Instances data = source.getDataSet();
            if (data.classIndex() == -1)
                data.setClassIndex(data.numAttributes() - 1);
            return data;
        } catch (Exception e) {
            throw new IOException("Something went wrong while reading file. Please check if the" +
                    "file is the right format.");
        }
    }
}

And the output:

10.103,19.589,3,0,0,1,2,1,1,2,2,2,0,1,94,0,0,1,4,1,1,0,0,1,1,0,1,0,3,2,2,2,1,4,1,2,1,63,0,0,0,0,0,8,0,0,6.9,311,1,3,0.9,2.9,1.1,0.000062
10.103,19.589,3,0,0,1,2,1,1,2,2,2,0,1,94,0,0,1,4,1,1,0,0,1,1,0,1,0,3,2,2,2,1,4,1,2,1,63,0,0,0,0,0,8,0,0,6.9,311,1,3,0.9,2.9,1.1,0.000062
10.103,19.589,3,0,0,1,2,1,1,2,2,2,0,1,94,0,0,1,4,1,1,0,0,1,1,0,1,0,3,2,2,2,1,4,1,2,1,63,0,0,0,0,0,8,0,0,6.9,311,1,3,0.9,2.9,1.1,0.000062
10.103,19.589,3,0,0,1,2,1,1,2,2,2,0,1,94,0,0,1,4,1,1,0,0,1,1,0,1,0,3,2,2,2,1,4,1,2,1,63,0,0,0,0,0,8,0,0,6.9,311,1,3,0.9,2.9,1.1,0.000062

So, the last column in the csv results should be a illness, but it’s 0.00062.

Why is this not working properly?