Unable to save model in binary mode

pengie
pengie New Altair Community Member
edited November 5 in Community Q&A
Hi,

I am trying to standardize some attributes and then save the resultant model into a file using the binary mode. The process file is as follows:

<operator name="Root" class="Process" expanded="yes">
    <operator name="CSVExampleSource" class="CSVExampleSource">
        <parameter key="filename" value="training.csv"/>
    </operator>
    <operator name="Standardize" class="Normalization">
        <parameter key="create_view" value="true"/>
        <parameter key="return_preprocessing_model" value="true"/>
        <parameter key="z_transform" value="false"/>
    </operator>
    <operator name="Save Standardize parameters" class="ModelWriter">
        <parameter key="model_file" value="training.mod"/>
        <parameter key="output_type" value="Binary"/>
    </operator>
</operator>
On running, I got the error 303: Cannot write to file. The details are:

Exception: com.rapidminer.operator.UserError
Message: Could not write to file 'training.mod': com.rapidminer.tools.Tupel.
Stack trace:

  com.rapidminer.operator.io.ModelWriter.apply(ModelWriter.java:159)
  com.rapidminer.operator.Operator.apply(Operator.java:664)
  com.rapidminer.operator.OperatorChain.apply(OperatorChain.java:377)
  com.rapidminer.operator.Operator.apply(Operator.java:664)
  com.rapidminer.Process.run(Process.java:614)
  com.rapidminer.Process.run(Process.java:584)
  com.rapidminer.Process.run(Process.java:574)
  com.rapidminer.gui.ProcessThread.run(ProcessThread.java:61)

Cause
Exception: java.io.NotSerializableException
Message: com.rapidminer.tools.Tupel
Stack trace:

  java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
  java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
  java.util.HashMap.writeObject(HashMap.java:1001)
  sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:597)
  java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
  java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
  java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
  java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
  java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
  java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
  java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
  java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
  java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
  com.rapidminer.operator.io.ModelWriter.apply(ModelWriter.java:157)
  com.rapidminer.operator.Operator.apply(Operator.java:664)
  com.rapidminer.operator.OperatorChain.apply(OperatorChain.java:377)
  com.rapidminer.operator.Operator.apply(Operator.java:664)
  com.rapidminer.Process.run(Process.java:614)
  com.rapidminer.Process.run(Process.java:584)
  com.rapidminer.Process.run(Process.java:574)
  com.rapidminer.gui.ProcessThread.run(ProcessThread.java:61)
It seems that the class Tupel is not serializable. Is this a bug?
Tagged:

Answers

  • pengie
    pengie New Altair Community Member
    It seems that the problem can be solved simply by editing the Tupel.java file. Just add Serializable to the implements and add a static final long serialVersionUID. Example:

    public class Tupel<T1 extends Comparable<T1>, T2> implements Comparable<Tupel<T1, T2>>, Serializable {

    private static final long serialVersionUID = 1322589550168140645L;
    The number for serialVersionUID is obtained from http://functionalj.sourceforge.net/, Pair class but I guess any number will do.
  • IngoRM
    IngoRM New Altair Community Member
    Hi,

    yes, you are right. We will add the Serializable interface in the CVS version.

    Thanks for pointing this out,
    cheers,
    Ingo
  • pengie
    pengie New Altair Community Member
    Hi,

    I think this problem has reoccurred, at least in the latest 4.4 version. I have checked the CVS version and it seems like the serializable interface has not been added.

    Warmest regards
  • IngoRM
    IngoRM New Altair Community Member
    Hi,

    I am sorry - we seemed to overlook this. I have just added this (directly) to the CVS so it is sure that it is part of the next release. If you can't wait: feel free to build RM yourself.

    By the way: since I am not a native speaker and got the feeling that "warmest regards" might have some additional meaning I didn't get correclty I googled for it and Google came up with this great blog entry:

    http://www.pauldavidson.net/2006/12/19/wfmes-list-of-regards/

    But warmest regards must be used carefully. Never to be used seriously, warmest regards should only be used when sending sarcastic letters to consumer assistance personnel from big companies who have screwed you. Or to anyone whom you are mad at. Or to that funeral home who misplaced your Uncle Ferry’s body. This is the lowest of the lows. This is the only passive agressive sign-off in the regards-family. Use it with care.
    This and the other descriptions on that page are really a pleasure to read so I can only recommend this page (at least for non-native speakers).

    But are you really mad at us? I don't hope  ;)

    Cheers and thanks (again!) for pointing this out,
    Ingo
  • pengie
    pengie New Altair Community Member
    Haha, of course I am not mad at you all. You all are doing a great job  ;D. Not too sure on what basis did the blog entry used for the various greetings. At least in our country, where English is the primary language used, Warmest regards is used quite frequently, with no hidden meanings.
  • IngoRM
    IngoRM New Altair Community Member
    I am glad to hear you kind words  :D

    And also that warmest regards can be used without hidden meanings. Anyway, the blog was well written and a pleasure to read...

    All the best,
    Ingo