Re: BVDecompose Error

Peter Reutemann <[email protected]>
Newsgroups gmane.comp.ai.weka
Message-ID <[email protected]>
The setClassIndex method of BVDecompose uaes a 1-based index, not 0-based:

https://weka.sourceforge.io/doc.dev/weka/classifiers/BVDecompose.html#setClassIndex-int-

Cheers, Peter

On July 20, 2021 5:42:11 PM GMT+12:00, Warren Fernando <[email protected]> wrote:
>Hi Guys,
>
>I've been using the BVDecompose class on my datasets, and it works fine
>in
>the CLI; however, when using it in java code with the API I
>persistently
>get the error: Exception in thread "main" java.lang.Exception: Class
>attribute must be nominal. I'm confused as to how to fix this as there
>are
>no issues with any of the datasets in the WEKA GUI and the CLI. It
>should
>be noted that the class attribute is recognised as a nominal value in
>both
>the GUI and CLI.
>My attributes are as follows:
>@relation Ransomware
>@attribute NtEnumerateValueKey numeric
>@attribute SearchPathW numeric
>@attribute SetFilePointerEx  numeric
>@attribute NtGetContextThread numeric
>@attribute CreateRemoteThread numeric
>@attribute NtQueryValueKey numeric
>@attribute SetErrorMode numeric
>@attribute GetSystemMetrics numeric
>@attribute NtSetValueKey numeric
>@attribute NtDelayExecution numeric
>@attribute Thread32First numeric
>@attribute SHGetSpecialFolderLocation numeric
>@attribute NtTerminateThread numeric
>@attribute NtCreateThread numeric
>@attribute NtWriteVirtualMemory numeric
>@attribute NtOpenKeyEx numeric
>@attribute RegQueryInfoKeyW numeric
>@attribute RegEnumValueA numeric
>@attribute FindResourceExW numeric
>@attribute DrawTextExW numeric
>@attribute Class {0,1}
>
>My code is as follows:
>
>    public RF() throws IOException, Exception {
>
>        BufferedReader reader = new BufferedReader(new
>FileReader("src/MostEffective2018.arff"));
>
>        ArffLoader.ArffReader arff = new ArffLoader.ArffReader(reader);
>        int numFolds = 10;
>        data = arff.getData();
>        data.setClassIndex(data.numAttributes() - 1);
>
>        RandomForest rf = new RandomForest();
>        rf.setNumIterations(100);
>        rf.setMaxDepth(0);
>        rf.buildClassifier(data);
>
>        Evaluation eval = new Evaluation(data);
>      eval.crossValidateModel(rf, data, numFolds, new Debug.Random(1));
>        System.out.println(eval.recall(1));
>        System.out.println(eval.recall(0));
>
>        String file = new String("src/MostEffective2018.arff");
>        BVDecomposeSegCVSub bv = new BVDecomposeSegCVSub();
>        bv.setDataFileName(file);
>
>
>        bv.setClassIndex(data.numAttributes() - 1);
>        bv.setClassifier(rf);
>        System.out.println(bv.getClassIndex());
>
>        bv.decompose();
>        System.out.println(bv.toString());
>
>    }
>
>
>Any help with this would be very much appreciated!
>
>Thanks,
>Warren

--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 577-5304
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/.

_______________________________________________
Wekalist mailing list -- [email protected]
Send posts to [email protected]
To unsubscribe send an email to [email protected]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.