EdwardRaff / JSAT

Java Statistical Analysis Tool, a Java library for Machine Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug in the ARFFLoader

kasium opened this issue · comments

While loading an ARFF file, there's a bug with the naming of numeric variables:
Line 199: There is no need to use the helper variable k.
Simple Example: The list "variableNames" contains "A", "B", "C". "A" is a categorical variable.
Inside your loop, you check if the variable is numeric, so in the first iteration no name will be set, i will be 1 and k is 0. In the second iteration you use k to get name. Normally this should be "B", but because k is 0, you will get "A", which is wrong.
So just remove k and use i and everything will be fine.

This is a simple test case for you:
ARFFTest.txt

Like you can see, the second numeric attribute has the name of the categorical attribute.

You should start from 0 index instead of 1 in your test case. But either way, thanks! Bug is fixed now. Sorry for the delay, I've been busy!