"protypes making by clustering"

m_r_nour
m_r_nour New Altair Community Member
edited November 5 in Community Q&A
Hi all

I want to use centers of clusters in each class  as new data to reduce number of the samples:

as far as I know I should make an iteration among classes and in each class make  a cluster and uses centers of clusters as a new sample.
but I do not know how? I made a draft code but I works just to filtering and clustering and it is not able to use and save them.


Regards
REZA

<operator name="Root" class="Process" expanded="yes">
    <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
        <parameter key="target_function" value="polynomial classification"/>
        <parameter key="number_examples" value="1000"/>
        <parameter key="number_of_attributes" value="20"/>
    </operator>
    <operator name="Normalization" class="Normalization">
        <parameter key="create_view" value="true"/>
    </operator>
    <operator name="protyper" class="OperatorChain" expanded="yes">
        <operator name="ValueIterator (2)" class="ValueIterator" expanded="yes">
            <parameter key="attribute" value="label"/>
            <operator name="ExampleFilter (3)" class="ExampleFilter">
                <parameter key="condition_class" value="attribute_value_filter"/>
                <parameter key="parameter_string" value="label = %{loop_value}"/>
            </operator>
            <operator name="KMeans" class="KMeans">
                <parameter key="keep_example_set" value="false"/>
                <parameter key="k" value="4"/>
            </operator>
            <operator name="ExceptionHandling" class="ExceptionHandling" expanded="yes">
                <operator name="ExampleSetMerge (2)" class="ExampleSetMerge">
                </operator>
            </operator>
        </operator>
        <operator name="IOConsumer (2)" class="IOConsumer" breakpoints="after">
            <parameter key="io_object" value="ClusterModel"/>
        </operator>
        <operator name="Final Retrieve (2)" class="IORetriever">
            <parameter key="name" value="Cluster Model"/>
            <parameter key="io_object" value="ClusterModel"/>
        </operator>
    </operator>
    <operator name="In every case: Store (2)" class="IOStorer">
        <parameter key="name" value="Cluster Model"/>
        <parameter key="io_object" value="ClusterModel"/>
    </operator>
</operator>

Answers

  • land
    land New Altair Community Member
    Hi,
    unfortunately this isn't possible with the current versions of RapidMiner. Might be, there will be an operator building an example set from a flat cluster model in 5.0.

    Greetings,
      Sebastian
  • haddock
    haddock New Altair Community Member
    G'day,
    I want to use centers of clusters in each class  as new data to reduce number of the samples:
    An alternative would be to say that each label value is the name of a cluster, and that a protototype for a cluster would have for each attribute a value equal to the average for that attribute in that cluster. In that case you can do the following...
    <operator name="Root" class="Process" expanded="yes">
        <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
            <parameter key="target_function" value="simple non linear classification"/>
            <parameter key="number_of_attributes" value="10"/>
        </operator>
        <operator name="ValueIterator" class="ValueIterator" expanded="yes">
            <parameter key="attribute" value="label"/>
            <operator name="ExampleFilter" class="ExampleFilter">
                <parameter key="condition_class" value="attribute_value_filter"/>
                <parameter key="parameter_string" value="label=%{loop_value}"/>
            </operator>
            <operator name="FeatureNameFilter" class="FeatureNameFilter">
                <parameter key="filter_special_features" value="true"/>
                <parameter key="skip_features_with_name" value="label"/>
            </operator>
            <operator name="ExampleSetTranspose" class="ExampleSetTranspose">
            </operator>
            <operator name="AttributeAggregation" class="AttributeAggregation">
                <parameter key="attribute_name" value="Average_%{loop_value}"/>
                <parameter key="aggregation_attributes" value=".*"/>
                <parameter key="aggregation_function" value="average"/>
            </operator>
            <operator name="ExampleSetTranspose (2)" class="ExampleSetTranspose">
            </operator>
        </operator>
        <operator name="ExampleSetMerge" class="ExampleSetMerge">
        </operator>
        <operator name="ExampleFilter (2)" class="ExampleFilter">
            <parameter key="condition_class" value="attribute_value_filter"/>
            <parameter key="parameter_string" value="id=att.*"/>
            <parameter key="invert_filter" value="true"/>
        </operator>
    </operator>