jeffheaton / encog-java-core

http://www.heatonresearch.com/encog
Other
744 stars 268 forks source link

NormalizationHelper is not serializable #210

Closed awwal closed 7 years ago

awwal commented 9 years ago

In the IrisClassification class, it is said

You do not need to retrain, simply use the NormalizationHelper class. After you train, you can save the NormalizationHelper to later normalize and denormalize your data.

An attempt to save like this

  SerializeObject.save(file, helper);

throws the exception below. This seems to be due to the fact that BasicNormalizationStrategy is not serializable.

java.io.NotSerializableException: org.encog.ml.data.versatile.normalizers.strategies.BasicNormalizationStrategy at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) at org.encog.util.obj.SerializeObject.save(SerializeObject.java:79)

There is already a SOF regarding this http://stackoverflow.com/questions/29008927/normalizationhelper-how-to-save-it-to-a-file

andrewthomas28 commented 9 years ago

If I understand correctly, the serialization issue should be addressed in v3.4 by issue #194, “NormalizationHelper is not serializable”, https://github.com/encog/encog-java-core/issues/194 .

From: Lawal Olufowobi [mailto:notifications@github.com] Sent: Tuesday, June 9, 2015 2:03 PM To: encog/encog-java-core Subject: [encog-java-core] NormalizationHelper is not serializable (#210)

In the IrisClassification class, it is said

You do not need to retrain, simply use the NormalizationHelper class. After you train, you can save the NormalizationHelper to later normalize and denormalize your data.

An attempt to save like this

SerializeObject.save(file, helper);

throws the exception below. This seems to be due to the fact that BasicNormalizationStrategy is not serializable.

java.io.NotSerializableException: org.encog.ml.data.versatile.normalizers.strategies.BasicNormalizationStrategy at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) at org.encog.util.obj.SerializeObject.save(SerializeObject.java:79)

There is already a SOF regarding this http://stackoverflow.com/questions/29008927/normalizationhelper-how-to-save-it-to-a-file

— Reply to this email directly or view it on GitHubhttps://github.com/encog/encog-java-core/issues/210.

jeffheaton commented 7 years ago

I just tested with the current 3.4 and do not get an error. This will be part of Encog 3.4.