Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Unable to load old models: backward compatibility problem?

  1. #1
    Join Date
    Oct 2016
    Posts
    1

    Default Unable to load old models: backward compatibility problem?

    Dear all,

    I've been developing for many years now a Java application that uses WEKA as learning library. After upgrading our WEKA jar from 3.7.9 to 3.9.0, we are unable to use the old saved models because the train header can't be properly read anymore. We have identified the problem in the transition from WEKA 3.7.11 to 3.7.12.

    These few lines of code can reproduce the error:

    import weka.core.SerializationHelper;
    import weka.core.Instances;
    import hr.irb.fastRandomForest.FastRandomForest;

    // read both model and train header
    Object[] obj = SerializationHelper.readAll( "classifier 2.0 .model" );
    // cast first object to FastRandomForest
    FastRandomForest frf = (FastRandomForest) obj[ 0 ];
    // cast second object to Instances
    Instances data = (Instances) obj[ 1 ];

    The exception thrown is the following:

    java.lang.NullPointerException
    at weka.core.Attribute.enumerateValues(Attribute.java:336)
    at weka.core.Attribute.toString(Attribute.java:663)
    at java.lang.String.valueOf(String.java:2994)
    at java.lang.StringBuffer.append(StringBuffer.java:265)
    at weka.core.Instances.toString(Instances.java:1714)
    at common.AbstractInterpreter.execute(AbstractInterpreter.java:661)
    at common.AbstractInterpreter$ExecuteCode.run(AbstractInterpreter.java:559)

    It seems the Instances class has changed fields since version 3.7.11 and some values are not readable any more. Is there any solution to maintain backward compatibility of the models or the users should create brand new models from scratch?

    Thanks a lot for your help!

  2. #2
    Join Date
    Aug 2006
    Posts
    1,741

    Default

    This has been answered over in the Weka mailing list:

    https://list.waikato.ac.nz/pipermail...er/067648.html

    Cheers,
    Mark.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.