Re: Why does `kNearestNeighbours` return more neighbours than `m_kNN` specified?
Lorenzo Ferron <[email protected]> Wed, 14 Feb 2024 23:45:10 +0100
| Newsgroups | gmane.comp.ai.weka |
|---|---|
| Message-ID | <[email protected]> |
I think that there is an issue on IBk cross validation. Let's suppose we change the previous step 6 into this one: weka.classifiers.lazy.IBk -K 17 -W 0 -X -E -A "weka.core.neighboursearch.LinearNNSearch -A \"weka.core.EuclideanDistance -D -R first-4\" -S" -output-debug-info. In Classifier output will appear <https://git.cms.waikato.ac.nz/weka/weka/-/blob/3cbb52f2172daeab749aedd5afbe1463775ca361/trunk/weka/src/main/java/weka/classifiers/lazy/IBk.java#L805-810>: IB1 instance-based classifier using 5 nearest neighbour(s) for classification But this is not true. Because that kis calculated considering /all/ instances in dataset without splitting it in two sets: training and test. WEKA is cheating like a student that sees a test before the exam. WEKA sees test set. But that value will be ignored when WEKA will do predictions on test set. So where do you find the “honest” knamely it calculated based only on training set? Well, you must read the output of terminal and find the last Selected k = <https://git.cms.waikato.ac.nz/weka/weka/-/blob/3cbb52f2172daeab749aedd5afbe1463775ca361/trunk/weka/src/main/java/weka/classifiers/lazy/IBk.java#L1007> string. This is possible because we add the option -output-debug-infoto IBk. In my case, it was 4. I think that this behaviour is misleading. It can confuse the user also because there are no info, disclaimer or pop-up about it. _______________________________________________ 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