Error while serializing PrincipalComponents

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error while serializing PrincipalComponents

Tim Lorsbach
Hi,

in one of my current projects I have to store a
weka.filters.unsupervised.attribute.PrincipalComponents object on disk.

As it implements the Filter interface, which itself implements the
Serializable interface, the PrincipalComponents object should be
serializable.

However, it throws a error due to the member "UpperSymmDenseMatrix
m_Correlation" not being serializable.

This field is only used in within the setup step and can be calculated
if the setup method is called again.

Attached you'll find a diff file making the member transient and
recalculate m_Correlation if required.

Best regards,

Tim


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

PrincipalComponents.diff (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Error while serializing PrincipalComponents

Eibe Frank-2
Administrator
Is it possible that this is because you are not using the modified mtj.jar that is used in WEKA?
In that version of mtj.jar, we modified Matrix.java to extend Serializable (and that is the only change).

Cheers,
Eibe

> On 15/05/2020, at 8:00 PM, Tim Lorsbach <[hidden email]> wrote:
>
> Hi,
>
> in one of my current projects I have to store a weka.filters.unsupervised.attribute.PrincipalComponents object on disk.
>
> As it implements the Filter interface, which itself implements the Serializable interface, the PrincipalComponents object should be serializable.
>
> However, it throws a error due to the member "UpperSymmDenseMatrix m_Correlation" not being serializable.
>
> This field is only used in within the setup step and can be calculated if the setup method is called again.
>
> Attached you'll find a diff file making the member transient and recalculate m_Correlation if required.
>
> Best regards,
>
> Tim
>
> <PrincipalComponents.diff>_______________________________________________
> Wekalist mailing list -- [hidden email]
> Send posts to [hidden email]
> To unsubscribe send an email to [hidden email]
> 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 -- [hidden email]
Send posts to [hidden email]
To unsubscribe send an email to [hidden email]
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