Re: How to classify unseen multi instance data?

Peter Reutemann <[email protected]> Thu, 25 Jan 2024 15:56:08 +1300
Newsgroups gmane.comp.ai.weka
Message-ID <CAHoQ12+ddu2Zk8=daLup1DGFzDGeptUK5Usrncke028D_N56Ww@mail.gmail.com>
> I have created quite a few models with the various multi instance
> classifiers available and would now like to use them to classify unseen
> multi instance data.
>
> However, there appears to be no method in the Weka Java API to do this.
> The usual method for single instance data is:
>
> AbstractClassifier.classifyInstance(Instance data);
>
> However, for multi instance data I have Instances instead of Instance.
> So how do I classify an object of type Instances?
>
> I could of course loop over all Instance objects contained in Instances
> and classify each of them, but that appears to be a series of single
> instance classifications, whereas the model was trained on multi
> instance data. Does that make sense at all?

Even for multi-instance data you only use a single Instance object,
representing a single bag, for making predictions.
And yes, looping over the individual bags is how Weka accumulates
statistics for test sets, for instance.
Test data or data to just make predictions on must have the same
structure as the training data (see
Instances.equalHeadersMsg(Instances)).
When just making predictions, the class values can be missing, as no
ground truth required to calculate statistics.

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]
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