How to log the size of W-J48 Tree?
wessel
New Altair Community Member
Dear All,
How can I log the value of the the size of W-J48 Tree?
E.g.
Number of Leaves : 7
Size of the tree : 13
Best regards,
Wessel
How can I log the value of the the size of W-J48 Tree?
E.g.
Number of Leaves : 7
Size of the tree : 13
Best regards,
Wessel
Tagged:
0
Answers
-
Hi,
I fear that you will need the "Execute Script" operator. Please see the following process for an example:
Regards,
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.0.004">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="6.0.004" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="6.0.004" expanded="true" height="60" name="Retrieve Golf" width="90" x="45" y="30">
<parameter key="repository_entry" value="//Samples/data/Golf"/>
</operator>
<operator activated="true" class="weka:W-J48" compatibility="5.3.001" expanded="true" height="76" name="W-J48" width="90" x="179" y="30"/>
<operator activated="true" class="execute_script" compatibility="6.0.004" expanded="true" height="76" name="Execute Script" width="90" x="313" y="30">
<parameter key="script" value="import com.rapidminer.operator.learner.weka.WekaClassifier; import weka.classifiers.trees.J48; import com.rapidminer.tools.LogService; import java.util.logging.Level; WekaClassifier classifier = (WekaClassifier)input[0]; J48 j48 = classifier.getClassifier(); LogService.getRoot().log(Level.INFO, "WEKA TREE SIZE: "+j48.measureTreeSize()); LogService.getRoot().log(Level.INFO, "WEKA LEAF NUMBER: "+j48.measureNumLeaves()); return input[0];"/>
</operator>
<connect from_op="Retrieve Golf" from_port="output" to_op="W-J48" to_port="training set"/>
<connect from_op="W-J48" from_port="model" to_op="Execute Script" to_port="input 1"/>
<connect from_op="Execute Script" from_port="output 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
Marco0 -
Thanks a million Marco!
0