US and Worldwide: +1 (866) 660-7555
Results 1 to 5 of 5

Thread: Help needed to use weka.dll(converted using IKVM) to deserialize an ANN model

  1. #1

    Exclamation Help needed to use weka.dll(converted using IKVM) to deserialize an ANN model

    Hello All,

    I am posting on Pentaho forum for very first time. Any help would be much appreciated.

    I am running into following issue while trying to use weka.dll (.net version of weka.jar converted using IKVM) in my .net 4.0 project. I have followed steps mentioned in - http://weka.wikispaces.com/IKVM+with+Weka+tutorial . The exact steps worked for me and I was able to create a weka.dll file.

    Useful Information -
    1. I am running Weka(3.6.7) for Windows x64 in a 64 bit Intel® Core i7 3.40GHZ desktop machine and Windows 7
    2. I am running Java™ 6.0.210.7 version
    3. I downloaded IKVM 7.0.4335.0 into my Program Files folder


    When I try to serialize my ANN model (generated using WEKA console) in my C# code (like below) using “weka.dll” I get “InvalidClassException” error

    Code – “weka.classifiers.Classifier cl = (weka.classifiers.Classifier)weka.core.SerializationHelper.read(filepath + @"\test.model");”

    Error thrown - “java.io.InvalidClassException: javax.swing.JComponent; local class incompatible: stream classdesc serialVersionUID = -1030230214076481435, local class serialVersionUID = 5670834184508236790}” – I have included the stack trace at the bottom of this message

    I have tested running the model through a JAVA interface using weka.jar, and it has worked absolutely fine.

    While running IKVM to convert weka.jar file into weka.dll file it gave me following warning which I ignored – unable to compile class “weka.gui.MacArffOpenFilesHandler” <missing class “com.apple.eawt.OpenFilesHandler”>

    Thanks,
    Saurabh

    Just in case, I have included steps that I have used to convert weka.jar file into weka.dll

    IKVM Setup -
    1. Download IKVM package from http://sourceforge.net/project/showf...group_id=69637 and put the folder extracted under C:\Program Files
    2. In command line prompt browse to C:\Program Files\IKVM and type IKVM and hit enter to test it
    3. Setup the environment for using IKVM tools
      1. Add "C:\Program Files\ikvm-7.0.4335.0\bin" to Path variable in system environment
      2. Add "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322" to Path variable in system environment

    4. Use IKVMC to convert the WEKA jar files to .net dll (http://www.ikvm.net/userguide/ikvmc.html )


    Creating Weka dll
    1. Change directory to location, where weka.jar file is located, in command prompt
    2. Run following command ikvmc -target:library weka.jar
    3. This will create weka.dll file

    Referencing weka in .net project -
    1. Add reference to generated weka.dll
    2. Add reference to IKVM.Runtime from C:\Program Files\ikvm-7.0.4335.0\bin
    3. Add reference to IKVM.OpenJDK.Core from C:\Program Files\ikvm-7.0.4335.0\bin


    Stack trace of the error –
    at java.io.ObjectStreamClass.invokeReadObject(Object , ObjectInputStream )
    at java.io.ObjectInputStream.readSerialData(Object , ObjectStreamClass )
    at java.io.ObjectInputStream.readOrdinaryObject(Boolean )
    at java.io.ObjectInputStream.readObject0(Boolean )
    at java.io.ObjectInputStream.defaultReadFields(Object , ObjectStreamClass )
    at java.io.ObjectInputStream.readSerialData(Object , ObjectStreamClass )
    at java.io.ObjectInputStream.readOrdinaryObject(Boolean )
    at java.io.ObjectInputStream.readObject0(Boolean )
    at java.io.ObjectInputStream.readObject()
    at weka.core.SerializationHelper.read(InputStream stream)
    at weka.core.SerializationHelper.read(String filename)
    at WEKAInitializer.UnitTest1.LoadANNModel() in C:\Users\saurabh\Documents\Visual Studio 2010\Projects\WEKAInitializer\WEKAInitializer\UnitTest1.cs:line 71

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

    Default

    This has been answered over on the Weka mailing list:

    https://list.scms.waikato.ac.nz/mail...ne/055759.html

  3. #3
    Join Date
    Jul 2014
    Posts
    6

    Default

    Dear Community,

    i am so sorry that i open the old thread. But I have excact the same Problem and the link to the mailing list doesn't work. Can somebody give me
    a solution to that problem?

    thank you very much.

  4. #4
    Join Date
    Aug 2006
    Posts
    1,432

    Default

    I've never used IKVM I'm afraid. I'd suggest that you use the latest version of Weka 3.6 and see if the serialisation error is specific to just the MultilayerPerceptron classifier.

    Cheers,
    Mark.

  5. #5
    Join Date
    Jul 2014
    Posts
    6

    Default

    Hello Mark,

    I think I get the Error everytime when i serialize something on WEKA and load it from IKVM over the weka.dll. I found out that I get the error when do this with the KnowledgeFlow.

    I could save all things with XML, I bet then I wouldn't get the errors. The problem is that I can't save the trained model then.

    When you have any idea, tell me...

    Thank you very much.

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
  •