Re: How to classify unseen multi instance data?

Ulrich Mayring <[email protected]> Mon, 29 Jan 2024 14:40:13 +0100
Newsgroups gmane.comp.ai.weka
Message-ID <[email protected]>
Hi Peter,

Am 29.01.24 um 04:11 schrieb Peter Reutemann:
>>> At prediction time you re-use (rather than re-create) the header from
>>> the training data to create new Instance objects. These Instance
>>> objects you then present to the classifier to obtain predictions.
>>
>> Are there any examples for how this procedure works with multi-instance
>> data?
> 
> There is no difference to non-multi-instance data.
> The wiki example demonstrates how to fill a relational attribute with
> values (I may have already posted that before):
> https://waikato.github.io/weka-wiki/formats_and_processing/creating_arff_file/

I meant actual Java code that demonstrates how to re-use an existing 
header during classification. I did not find any such examples and could 
not get it to work myself.

> It depends. If you've saved a model with the Explorer, then it would
> contain the header (an empty Instances object with the structure) as
> the second object in the serialized file.

If that was the case, then shouldn't I find a call to 
SerializationHelper.writeAll somewhere in the Weka sources? However, 
there's only SerializationHelper.write in core/Debug.java. I downloaded 
the sources from https://git.cms.waikato.ac.nz/weka/weka/-/tree/main/trunk

> If you don't actually save your model anywhere, but just keep in
> memory, then you would create an empty copy of the training data with
> something like:
> Instances train = ...  // your training data
> Instances header = new Instances(train, 0);

When I create the header like that and save it with the 
SerializationHelper I am getting a file of 110MB, of which the actual 
classifier has less than 1 MB. So somehow this header appears to be very 
large, even though it does not contain any instances. My guess is that 
it still contains all the instances from the training data, even though 
they're not accessible anymore.

>>> The RELAGGS filter is specifically designed for processing data from a
>>> relational database (the original code worked straight off JDBC
>>> databases):
>>> https://weka.sourceforge.io/doc.stable/weka/filters/unsupervised/attribute/RELAGGS.html
>>
>> Are there any examples how to use this filter in Java? What kind of
>> processing does it do?
> 
> You can apply it straight to your multi-instance data. Works just like
> any other filter.

Yes, sure, but what does this filter actually do? What is my benefit 
from using it?

Kind regards,

Ulrich



_______________________________________________
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