Android でトレーニング済みの多層パーセプトロン モデルをシリアル化する際に問題があります。WekaSTRIPPED.jar (WEKA-for-Android) を使用しています
私のコードは次のとおりです。
Classifier cModel = new MultilayerPerceptron();
try {
cModel.buildClassifier(trainFile);
weka.core.SerializationHelper.write(Directory + "/FourFModels/MLP.model", cModel);
Log.e("MLP model", "created");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
私が得たエラー:
06-14 12:23:48.776: E/AndroidRuntime(336): FATAL EXCEPTION: main
06-14 12:23:48.776: E/AndroidRuntime(336): java.lang.IllegalStateException: Could not execute method of the activity
06-14 12:23:48.776: E/AndroidRuntime(336): at android.view.View$1.onClick(View.java:3599)
06-14 12:23:48.776: E/AndroidRuntime(336): at android.view.View.performClick(View.java:4204)
06-14 12:23:48.776: E/AndroidRuntime(336): at android.view.View$PerformClick.run(View.java:17355)
06-14 12:23:48.776: E/AndroidRuntime(336): at android.os.Handler.handleCallback(Handler.java:725)
06-14 12:23:48.776: E/AndroidRuntime(336): at android.os.Handler.dispatchMessage(Handler.java:92)
06-14 12:23:48.776: E/AndroidRuntime(336): at android.os.Looper.loop(Looper.java:137)
06-14 12:23:48.776: E/AndroidRuntime(336): at android.app.ActivityThread.main(ActivityThread.java:5041)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.lang.reflect.Method.invokeNative(Native Method)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.lang.reflect.Method.invoke(Method.java:511)
06-14 12:23:48.776: E/AndroidRuntime(336): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-14 12:23:48.776: E/AndroidRuntime(336): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-14 12:23:48.776: E/AndroidRuntime(336): at dalvik.system.NativeStart.main(Native Method)
06-14 12:23:48.776: E/AndroidRuntime(336): Caused by: java.lang.reflect.InvocationTargetException
06-14 12:23:48.776: E/AndroidRuntime(336): at java.lang.reflect.Method.invokeNative(Native Method)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.lang.reflect.Method.invoke(Method.java:511)
06-14 12:23:48.776: E/AndroidRuntime(336): at android.view.View$1.onClick(View.java:3594)
06-14 12:23:48.776: E/AndroidRuntime(336): ... 11 more
06-14 12:23:48.776: E/AndroidRuntime(336): Caused by: java.lang.StackOverflowError
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.SerializationHandleMap.get(SerializationHandleMap.java:63)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.dumpCycle(ObjectOutputStream.java:425)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:754)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeNewArray(ObjectOutputStream.java:1134)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1662)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
06-14 12:23:48.776: E/AndroidRuntime(336): at java.io.ObjectOutputStream.writeNewArray(ObjectOutputStream.java:1205)
どんな助けでも大歓迎です。