Re: Inconsistencies between GUI and Java code
Michael Hall <[email protected]> Wed, 22 Nov 2023 20:16:31 -0600
| Newsgroups | gmane.comp.ai.weka |
|---|---|
| Message-ID | <[email protected]> |
> On Nov 21, 2023, at 10:48 AM, Ulrich Mayring <[email protected]> wrote: > > The GUI shows me this command line: > weka.classifiers.functions.MultilayerPerceptron -L 0.3 -M 0.2 -N 500 -V 0 -S 0 -E 20 -H "9, 15, 6" > The evaluation results for both methods are different! > > My Java code runs about 3.5 minutes and reports an accuracy of 74.3% and the size of the model, when saved to a file, is 40054 Bytes. > > The Weka GUI runs about 8.5 minutes and reports an accuracy of 75.9% and the size of the model is 41715 KByte. Possibly the parameter defaults are different in some regard? You could try… // -L 0.3 classifer.setLearningRate(0.3d); // -N 500 classifier.setTrainingTime(500); // -M 0.2 classifier.setMomentum(0.2d); // -V 0 classifier.setValidationSetSize(0); // -S 0 classifier.setSeed(0); // -E 20 classifier.setValidationThreshold(20); If I understood what the command line options were. If you want to see what parameters were used for a saved model you could use something like the following… try { FileInputStream serialFileIn = new FileInputStream(savedModel); ObjectInputStream serializedIn = SerializationHelper.getObjectInputStream(serialFileIn); StringBuilder sb = new StringBuilder(); Object o = serializedIn.readObject(); if (showOptions) { sb.append(o.getClass().toString().substring(6)); } else { System.out.println("Model class: " + o.getClass()); } String[] options = null; if (o instanceof OptionHandler) { options = ((OptionHandler)o).getOptions(); if (showOptions) { for (String option : options) { sb.append(" ").append(option); } System.out.println(sb); return; } else { System.out.println("Model options: "); for (String option : options) { System.out.println(" " + option); } } } System.out.println("----------"); System.out.println(o); Complete source http://mikehall.pairserver.com/WekaSerialConverter.java _______________________________________________ Wekalist mailing list -- [email protected] Send posts to [email protected] To unsubscribe send an email to [email protected] To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html