How to create ClusterModel from ExampleSet

PiccoloPaolo
PiccoloPaolo New Altair Community Member
edited November 5 in Community Q&A
Hello everybody,

I have the following problem. I am trying to apply an iterative clustering in a naive approach. I cluster once using 2-means and then I apply 2-means to every generated cluster. I am wondering:
1) is there a more efficient way to do this? I tried the loop cluster operator but I failed.
2) is it possible to generate a ClusterModel from the ExampleSet returned by Append? This would be useful to launch a ClusterModelVisualizer and some scripts that need both ClusterModel and ExampleSet.

Thanks to everyone who will help me.

 <?xml version="1.0" encoding="UTF-8"?><process version="9.3.001"><br>  <context><br>    <input/><br>    <output/><br>    <macros/><br>  </context><br>  <operator activated="true" class="process" compatibility="9.3.001" expanded="true" name="Process"><br>    <parameter key="logverbosity" value="init"/><br>    <parameter key="random_seed" value="2001"/><br>    <parameter key="send_mail" value="never"/><br>    <parameter key="notification_email" value=""/><br>    <parameter key="process_duration_for_mail" value="30"/><br>    <parameter key="encoding" value="SYSTEM"/><br>    <process expanded="true"><br>      <operator activated="true" class="retrieve" compatibility="9.3.001" expanded="true" height="68" name="Retrieve" width="90" x="45" y="85"><br>        <parameter key="repository_entry" value="//Samples/data/Iris"/><br>      </operator><br>      <operator activated="true" class="concurrency:k_means" compatibility="9.3.001" expanded="true" height="82" name="Clustering" width="90" x="179" y="85"><br>        <parameter key="add_cluster_attribute" value="true"/><br>        <parameter key="add_as_label" value="false"/><br>        <parameter key="remove_unlabeled" value="false"/><br>        <parameter key="k" value="2"/><br>        <parameter key="max_runs" value="10"/><br>        <parameter key="determine_good_start_values" value="true"/><br>        <parameter key="measure_types" value="BregmanDivergences"/><br>        <parameter key="mixed_measure" value="MixedEuclideanDistance"/><br>        <parameter key="nominal_measure" value="NominalDistance"/><br>        <parameter key="numerical_measure" value="EuclideanDistance"/><br>        <parameter key="divergence" value="SquaredEuclideanDistance"/><br>        <parameter key="kernel_type" value="radial"/><br>        <parameter key="kernel_gamma" value="1.0"/><br>        <parameter key="kernel_sigma1" value="1.0"/><br>        <parameter key="kernel_sigma2" value="0.0"/><br>        <parameter key="kernel_sigma3" value="2.0"/><br>        <parameter key="kernel_degree" value="3.0"/><br>        <parameter key="kernel_shift" value="1.0"/><br>        <parameter key="kernel_a" value="1.0"/><br>        <parameter key="kernel_b" value="0.0"/><br>        <parameter key="max_optimization_steps" value="100"/><br>        <parameter key="use_local_random_seed" value="false"/><br>        <parameter key="local_random_seed" value="1992"/><br>      </operator><br>      <operator activated="true" class="multiply" compatibility="9.3.001" expanded="true" height="103" name="Multiply" width="90" x="313" y="85"/><br>      <operator activated="true" class="filter_examples" compatibility="9.3.001" expanded="true" height="103" name="Filter Examples" width="90" x="447" y="85"><br>        <parameter key="parameter_expression" value=""/><br>        <parameter key="condition_class" value="custom_filters"/><br>        <parameter key="invert_filter" value="false"/><br>        <list key="filters_list"><br>          <parameter key="filters_entry_key" value="cluster.equals.cluster_0"/><br>        </list><br>        <parameter key="filters_logic_and" value="true"/><br>        <parameter key="filters_check_metadata" value="true"/><br>      </operator><br>      <operator activated="true" class="concurrency:k_means" compatibility="9.3.001" expanded="true" height="82" name="Clustering (2)" width="90" x="581" y="85"><br>        <parameter key="add_cluster_attribute" value="true"/><br>        <parameter key="add_as_label" value="false"/><br>        <parameter key="remove_unlabeled" value="false"/><br>        <parameter key="k" value="2"/><br>        <parameter key="max_runs" value="10"/><br>        <parameter key="determine_good_start_values" value="true"/><br>        <parameter key="measure_types" value="BregmanDivergences"/><br>        <parameter key="mixed_measure" value="MixedEuclideanDistance"/><br>        <parameter key="nominal_measure" value="NominalDistance"/><br>        <parameter key="numerical_measure" value="EuclideanDistance"/><br>        <parameter key="divergence" value="SquaredEuclideanDistance"/><br>        <parameter key="kernel_type" value="radial"/><br>        <parameter key="kernel_gamma" value="1.0"/><br>        <parameter key="kernel_sigma1" value="1.0"/><br>        <parameter key="kernel_sigma2" value="0.0"/><br>        <parameter key="kernel_sigma3" value="2.0"/><br>        <parameter key="kernel_degree" value="3.0"/><br>        <parameter key="kernel_shift" value="1.0"/><br>        <parameter key="kernel_a" value="1.0"/><br>        <parameter key="kernel_b" value="0.0"/><br>        <parameter key="max_optimization_steps" value="100"/><br>        <parameter key="use_local_random_seed" value="false"/><br>        <parameter key="local_random_seed" value="1992"/><br>      </operator><br>      <operator activated="true" class="filter_examples" compatibility="9.3.001" expanded="true" height="103" name="Filter Examples (2)" width="90" x="447" y="187"><br>        <parameter key="parameter_expression" value=""/><br>        <parameter key="condition_class" value="custom_filters"/><br>        <parameter key="invert_filter" value="false"/><br>        <list key="filters_list"><br>          <parameter key="filters_entry_key" value="cluster.equals.cluster_0"/><br>        </list><br>        <parameter key="filters_logic_and" value="true"/><br>        <parameter key="filters_check_metadata" value="true"/><br>      </operator><br>      <operator activated="true" class="concurrency:k_means" compatibility="9.3.001" expanded="true" height="82" name="Clustering (3)" width="90" x="581" y="187"><br>        <parameter key="add_cluster_attribute" value="true"/><br>        <parameter key="add_as_label" value="false"/><br>        <parameter key="remove_unlabeled" value="false"/><br>        <parameter key="k" value="2"/><br>        <parameter key="max_runs" value="10"/><br>        <parameter key="determine_good_start_values" value="true"/><br>        <parameter key="measure_types" value="BregmanDivergences"/><br>        <parameter key="mixed_measure" value="MixedEuclideanDistance"/><br>        <parameter key="nominal_measure" value="NominalDistance"/><br>        <parameter key="numerical_measure" value="EuclideanDistance"/><br>        <parameter key="divergence" value="SquaredEuclideanDistance"/><br>        <parameter key="kernel_type" value="radial"/><br>        <parameter key="kernel_gamma" value="1.0"/><br>        <parameter key="kernel_sigma1" value="1.0"/><br>        <parameter key="kernel_sigma2" value="0.0"/><br>        <parameter key="kernel_sigma3" value="2.0"/><br>        <parameter key="kernel_degree" value="3.0"/><br>        <parameter key="kernel_shift" value="1.0"/><br>        <parameter key="kernel_a" value="1.0"/><br>        <parameter key="kernel_b" value="0.0"/><br>        <parameter key="max_optimization_steps" value="100"/><br>        <parameter key="use_local_random_seed" value="false"/><br>        <parameter key="local_random_seed" value="1992"/><br>      </operator><br>      <operator activated="true" class="set_role" compatibility="9.3.001" expanded="true" height="82" name="Set Role" width="90" x="715" y="238"><br>        <parameter key="attribute_name" value="cluster"/><br>        <parameter key="target_role" value="regular"/><br>        <list key="set_additional_roles"/><br>      </operator><br>      <operator activated="true" class="replace" compatibility="9.3.001" expanded="true" height="82" name="Replace" width="90" x="849" y="238"><br>        <parameter key="attribute_filter_type" value="all"/><br>        <parameter key="attribute" value=""/><br>        <parameter key="attributes" value=""/><br>        <parameter key="use_except_expression" value="false"/><br>        <parameter key="value_type" value="nominal"/><br>        <parameter key="use_value_type_exception" value="false"/><br>        <parameter key="except_value_type" value="file_path"/><br>        <parameter key="block_type" value="single_value"/><br>        <parameter key="use_block_type_exception" value="false"/><br>        <parameter key="except_block_type" value="single_value"/><br>        <parameter key="invert_selection" value="false"/><br>        <parameter key="include_special_attributes" value="false"/><br>        <parameter key="replace_what" value="cluster_0"/><br>        <parameter key="replace_by" value="cluster_2"/><br>      </operator><br>      <operator activated="true" class="replace" compatibility="9.3.001" expanded="true" height="82" name="Replace (2)" width="90" x="983" y="238"><br>        <parameter key="attribute_filter_type" value="all"/><br>        <parameter key="attribute" value=""/><br>        <parameter key="attributes" value=""/><br>        <parameter key="use_except_expression" value="false"/><br>        <parameter key="value_type" value="nominal"/><br>        <parameter key="use_value_type_exception" value="false"/><br>        <parameter key="except_value_type" value="file_path"/><br>        <parameter key="block_type" value="single_value"/><br>        <parameter key="use_block_type_exception" value="false"/><br>        <parameter key="except_block_type" value="single_value"/><br>        <parameter key="invert_selection" value="false"/><br>        <parameter key="include_special_attributes" value="false"/><br>        <parameter key="replace_what" value="cluster_1"/><br>        <parameter key="replace_by" value="cluster_3"/><br>      </operator><br>      <operator activated="true" class="set_role" compatibility="9.3.001" expanded="true" height="82" name="Set Role (2)" width="90" x="1117" y="238"><br>        <parameter key="attribute_name" value="cluster"/><br>        <parameter key="target_role" value="cluster"/><br>        <list key="set_additional_roles"/><br>      </operator><br>      <operator activated="true" class="append" compatibility="9.3.001" expanded="true" height="103" name="Append" width="90" x="1251" y="136"><br>        <parameter key="datamanagement" value="double_array"/><br>        <parameter key="data_management" value="auto"/><br>        <parameter key="merge_type" value="all"/><br>      </operator><br>      <connect from_op="Retrieve" from_port="output" to_op="Clustering" to_port="example set"/><br>      <connect from_op="Clustering" from_port="clustered set" to_op="Multiply" to_port="input"/><br>      <connect from_op="Multiply" from_port="output 1" to_op="Filter Examples" to_port="example set input"/><br>      <connect from_op="Multiply" from_port="output 2" to_op="Filter Examples (2)" to_port="example set input"/><br>      <connect from_op="Filter Examples" from_port="example set output" to_op="Clustering (2)" to_port="example set"/><br>      <connect from_op="Clustering (2)" from_port="clustered set" to_op="Append" to_port="example set 1"/><br>      <connect from_op="Filter Examples (2)" from_port="example set output" to_op="Clustering (3)" to_port="example set"/><br>      <connect from_op="Clustering (3)" from_port="clustered set" to_op="Set Role" to_port="example set input"/><br>      <connect from_op="Set Role" from_port="example set output" to_op="Replace" to_port="example set input"/><br>      <connect from_op="Replace" from_port="example set output" to_op="Replace (2)" to_port="example set input"/><br>      <connect from_op="Replace (2)" from_port="example set output" to_op="Set Role (2)" to_port="example set input"/><br>      <connect from_op="Set Role (2)" from_port="example set output" to_op="Append" to_port="example set 2"/><br>      <connect from_op="Append" from_port="merged set" to_port="result 1"/><br>      <portSpacing port="source_input 1" spacing="0"/><br>      <portSpacing port="sink_result 1" spacing="0"/><br>      <portSpacing port="sink_result 2" spacing="0"/><br>    </process><br>  </operator><br></process><br><br>


Answers