Re: How to use InputMappedClassifier with a Bayesian Network

Florian van Daalen <[email protected]> Fri, 15 Dec 2023 08:48:13 +0000
Newsgroups gmane.comp.ai.weka
Message-ID <AM0PR07MB5985669FADA7A52B07610BF98493A@AM0PR07MB5985.eurprd07.prod.outlook.com>
Hi,


I have since found the problem.
Apparently I needed to do the following:

InputMappedClassifier input = new InputMappedClassifier();
input.setModelHeader(trianingDataSet);



I made the mistake of trying to use the validationSet, and the instances in BayesNet.m_Instances as the modelheader, both of which gave problems, despite supposedly having the same data structure.



Regards,

Florian van Daalen





-----Original Message-----
From: Peter Reutemann <[email protected]>
Sent: donderdag 14 december 2023 20:53
To: Weka machine learning workbench list. <[email protected]>
Subject: [Wekalist] Re: How to use InputMappedClassifier with a Bayesian Network



Waarschuwing: Deze email komt van buiten Maastro. Pas op met links in deze email of het openen van bijlagen.





> Can someone explain to me how I am supposed to use the InputMappedClassifier to validate a Bayesian Network using an external dataset?

>

> It seems like it cannot map the continuous attributes in the testset onto the now discretized equivalents in the Bayesian Network.

> However, I cannot find how to put the correct mapping in.

>

>

>

> Also, as the discretization is done automaticly by WEKA, I cannot simply discretize the test set myself.



Was your classifier wrapped in the InputMappedClassifier before you trained it?



The BayesNet classifier applies the same discretization filter to data that it is generating predictions for as it was trained on. You don't actually need to discretize the data yourself beforehand.



Rule of thumb for Weka is that training and test datasets have to have the *exact* structure: same # attributes, same order of attributes, same type of attributes, same # and order of labels for nominal attributes. That way you can avoid problems further down the track.



Cheers, Peter

--

Peter Reutemann

Dept. of Computer Science

University of Waikato, Hamilton, NZ

Mobile +64 22 190 2375

https://www.cs.waikato.ac.nz/~fracpete/

http://www.data-mining.co.nz/

_______________________________________________

Wekalist mailing list -- [email protected]<mailto:[email protected]> Send posts to [email protected]<mailto:[email protected]> To unsubscribe send an email to [email protected]<mailto:[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

_______________________________________________
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