[SOLVED] Access to IOObject
memvis70
New Altair Community Member
Hello,
I want to access to the entries of a ConfusionMatrix, so I can visualize the Matrix in my application,
I was trying to get access through the IOObject of the resulting IOContainer, but I didn't find a method.
Can I get access through the IOObject or is there another way to do that?
Thanks a lot for any response in advance!
Regards
I want to access to the entries of a ConfusionMatrix, so I can visualize the Matrix in my application,
I was trying to get access through the IOObject of the resulting IOContainer, but I didn't find a method.
Can I get access through the IOObject or is there another way to do that?
Thanks a lot for any response in advance!
Regards
0
Answers
-
Hi,
the following code snippet might help. You can have a look inside the ConfusionMatrixViewer class and check the ConfusionMatrixViewerTable.
MultiClassificationPerformance performance = (MultiClassificationPerformance) ioObject;
ConfusionMatrixViewer viewer = new ConfusionMatrixViewer(performance.getName(), performance.getTitle(), performance.getClassNames(), performance.getCounter());
Obligatory legal advice:
Please note that if you are using RapidMiner 5 in your application, it must be released under the AGPL v3. If that is not an option, please contact us for an OEM license.
The usage of RapidMiner Studio 6 inside your own application always requires an OEM license.
Regards,
Marco0 -
Hi,
First of all thank you for your response.
However I get the following exception:java.lang.ClassCastException: com.rapidminer.operator.performance.PerformanceVector cannot be cast to com.rapidminer.operator.performance.MultiClassificationPerformance
How can I handle this problem?
Best Regards
0 -
Is there a way to handle it or any other hint?
Thanks for any response in advance.0 -
Hi,
can you please post your process xml?
Regards,
Marco0 -
Hi Marco,
the process looks like this:<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
<parameter key="logverbosity" value="init"/>
<parameter key="random_seed" value="2001"/>
<parameter key="send_mail" value="never"/>
<parameter key="notification_email" value=""/>
<parameter key="process_duration_for_mail" value="30"/>
<parameter key="encoding" value="SYSTEM"/>
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="5.3.015" expanded="true" height="60" name="Retrieve A" width="90" x="112" y="75">
<parameter key="repository_entry" value="//Local Repository/A"/>
</operator>
<operator activated="true" class="retrieve" compatibility="5.3.015" expanded="true" height="60" name="Retrieve B" width="90" x="112" y="210">
<parameter key="repository_entry" value="//Local Repository/B"/>
</operator>
<operator activated="true" class="join" compatibility="5.3.015" expanded="true" height="76" name="Join" width="90" x="313" y="120">
<parameter key="remove_double_attributes" value="true"/>
<parameter key="join_type" value="inner"/>
<parameter key="use_id_attribute_as_key" value="true"/>
<list key="key_attributes"/>
<parameter key="keep_both_join_attributes" value="false"/>
</operator>
<operator activated="true" class="x_validation" compatibility="5.3.015" expanded="true" height="112" name="Validation" width="90" x="514" y="30">
<parameter key="create_complete_model" value="false"/>
<parameter key="average_performances_only" value="true"/>
<parameter key="leave_one_out" value="false"/>
<parameter key="number_of_validations" value="10"/>
<parameter key="sampling_type" value="stratified sampling"/>
<parameter key="use_local_random_seed" value="false"/>
<parameter key="local_random_seed" value="1992"/>
<process expanded="true">
<operator activated="true" class="decision_tree" compatibility="5.3.015" expanded="true" height="76" name="Decision Tree" width="90" x="179" y="165">
<parameter key="criterion" value="accuracy"/>
<parameter key="minimal_size_for_split" value="4"/>
<parameter key="minimal_leaf_size" value="2"/>
<parameter key="minimal_gain" value="0.1"/>
<parameter key="maximal_depth" value="20"/>
<parameter key="confidence" value="0.25"/>
<parameter key="number_of_prepruning_alternatives" value="3"/>
<parameter key="no_pre_pruning" value="false"/>
<parameter key="no_pruning" value="false"/>
</operator>
<connect from_port="training" to_op="Decision Tree" to_port="training set"/>
<connect from_op="Decision Tree" from_port="model" to_port="model"/>
<portSpacing port="source_training" spacing="0"/>
<portSpacing port="sink_model" spacing="0"/>
<portSpacing port="sink_through 1" spacing="0"/>
</process>
<process expanded="true">
<operator activated="true" class="apply_model" compatibility="5.3.015" expanded="true" height="76" name="Apply Model" width="90" x="112" y="75">
<list key="application_parameters"/>
<parameter key="create_view" value="false"/>
</operator>
<operator activated="true" class="performance" compatibility="5.3.015" expanded="true" height="76" name="Performance" width="90" x="112" y="300">
<parameter key="use_example_weights" value="true"/>
</operator>
<connect from_port="model" to_op="Apply Model" to_port="model"/>
<connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/>
<connect from_op="Apply Model" from_port="labelled data" to_op="Performance" to_port="labelled data"/>
<connect from_op="Performance" from_port="performance" to_port="averagable 1"/>
<portSpacing port="source_model" spacing="0"/>
<portSpacing port="source_test set" spacing="0"/>
<portSpacing port="source_through 1" spacing="0"/>
<portSpacing port="sink_averagable 1" spacing="0"/>
<portSpacing port="sink_averagable 2" spacing="0"/>
</process>
</operator>
<connect from_op="Retrieve A" from_port="output" to_op="Join" to_port="left"/>
<connect from_op="Retrieve B" from_port="output" to_op="Join" to_port="right"/>
<connect from_op="Join" from_port="join" to_op="Validation" to_port="training"/>
<connect from_op="Validation" from_port="model" to_port="result 1"/>
<connect from_op="Validation" from_port="training" to_port="result 2"/>
<connect from_op="Validation" from_port="averagable 1" to_port="result 3"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
<portSpacing port="sink_result 3" spacing="0"/>
<portSpacing port="sink_result 4" spacing="0"/>
</process>
</operator>
</process>0 -
Hi,
you can get the PerformanceVector by doing this:
You can also have a look at the PerformanceVectorRenderer class in the createReportable() method which calls the performanceVector.getCriterion() methods.
PerformanceVector performance = (PerformanceVector) ioObject;
Regards,
Marco0