"[Solved] Set Macro dynamically based on Dataset"
aryan_hosseinza
MemberPosts:74Contributor II
Hi ,
I am doing a down sampling by use of clustering , it's an imbalanced dataset which the number of example with 'f' label is about 6 times more than the number of examples with 't' label,
I want to set the K in clustering module equals to number of 't' examples in the dataset ,
How can I do that ?
Thanks
I am doing a down sampling by use of clustering , it's an imbalanced dataset which the number of example with 'f' label is about 6 times more than the number of examples with 't' label,
I want to set the K in clustering module equals to number of 't' examples in the dataset ,
How can I do that ?
Thanks
<运营商激活d="true" class="process" compatibility="5.2.008" expanded="true" name="Process">
<运营商激活d="true" class="retrieve" compatibility="5.2.008" expanded="true" height="60" name="Retrieve" width="90" x="45" y="75">
<运营商激活d="true" class="sample_stratified" compatibility="5.2.008" expanded="true" height="76" name="Sample (Stratified)" width="90" x="112" y="210">
<运营商激活d="true" class="nominal_to_numerical" compatibility="5.2.008" expanded="true" height="94" name="Nominal to Numerical" width="90" x="246" y="75">
<运营商激活d="true" class="normalize" compatibility="5.2.008" expanded="true" height="94" name="Normalize" width="90" x="380" y="75"/>
<运营商激活d="false" class="select_attributes" compatibility="5.2.008" expanded="true" height="76" name="Select Attributes" width="90" x="179" y="345">
<运营商激活= " true "类=“乘”兼容ibility="5.2.008" expanded="true" height="94" name="Multiply" width="90" x="581" y="75"/>
<运营商激活d="true" class="filter_examples" compatibility="5.2.008" expanded="true" height="76" name="Filter Examples (2)" width="90" x="782" y="255">
<运营商激活d="true" class="filter_examples" compatibility="5.2.008" expanded="true" height="76" name="Filter Examples" width="90" x="782" y="30">
<运营商激活= " true "类=“乘”兼容ibility="5.2.008" expanded="true" height="94" name="Multiply (2)" width="90" x="916" y="30"/>
<运营商激活d="true" class="k_means" compatibility="5.2.008" expanded="true" height="76" name="Clustering" width="90" x="1117" y="30">
<运营商激活d="true" class="apply_model" compatibility="5.2.008" expanded="true" height="76" name="Apply Model" width="90" x="1117" y="165">
<运营商激活d="true" class="remove_duplicates" compatibility="5.2.008" expanded="true" height="76" name="Remove Duplicates" width="90" x="1452" y="165">
<运营商激活d="true" class="union" compatibility="5.2.008" expanded="true" height="76" name="Union" width="90" x="1720" y="210"/>
<运营商激活d="true" class="select_attributes" compatibility="5.2.008" expanded="true" height="76" name="Select Attributes (3)" width="90" x="1921" y="210">
<运营商激活d="true" class="shuffle" compatibility="5.2.008" expanded="true" height="76" name="Shuffle" width="90" x="2055" y="210"/>
<连接from_op = "正常化" from_port = "的例子t output" to_op="Multiply" to_port="input"/>
0
Answers
One approach is to set a macro equal to the number of rows where the label is 't'. This can be done using the "Extract Macro" operator.
Then you need to use this macro as a parameter to the k-means operator.
It's very important to make sure the extraction happens before the k-means otherwise you will get an error.
I don't have your data so I can't test it but here's an example regards
Andrew
The calculation of the macro is happening after it is being used. Change the ordering from the GUI using Process->Operator Execution Order->Order Execution.
regards
Andrew