Can I use a macro value to filter an exampleset ?

kaymankayman Member Posts: 662 Unicorn
edited July 2019 in Help

I'm using a dictionary to allow a multiple search / replace dictionary. Works fine as such but I want to filter the dictionary so I can use it more flexible and with multiple operators.

In other words, I have a dictionary with 3 attributes, being 'filter', 'from' and 'to'. The filter works fine with static data, but I need it to be more dynamic, or macro driven. Since the filter operator does not seem to accept attr=%{my_macro_value} , I was wondering if there is another way to filter an exampleset with a dynamic value

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
  <operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="read_csv" compatibility="5.3.015" expanded="true" height="60" name="subcat_regex" width="90" x="45" y="165">
        <parameter key="csv_file" value="..\dictionaries\subcatmaker.csv"/>
        <parameter key="column_separators" value="&#9;"/>
        <parameter key="use_quotes" value="false"/>
        <parameter key="first_row_as_names" value="false"/>
        <list key="annotations"/>
        <parameter key="encoding" value="UTF-8"/>
        <list key="data_set_meta_data_information">
          <parameter key="0" value="filter.true.polynominal.attribute"/>
          <parameter key="1" value="from.true.polynominal.attribute"/>
          <parameter key="2" value="to.true.polynominal.attribute"/>
      <operator activated="true" class="filter_examples" compatibility="5.3.015" expanded="true" height="76" name="Filter Examples" width="90" x="179" y="165">
        <parameter key="condition_class" value="attribute_value_filter"/>
        <parameter key="parameter_string" value="ref=%{currCountry}"/>
      <operator activated="true" class="generate_attributes" compatibility="5.3.015" expanded="true" height="76" name="Generate Attributes" width="90" x="45" y="30">
        <list key="function_descriptions">
          <parameter key="productSubCategory" value="productDescription"/>
      <operator activated="true" class="replace_dictionary" compatibility="5.3.015" expanded="true" height="94" name="Replace (Dictionary)" width="90" x="179" y="30">
        <parameter key="attribute_filter_type" value="single"/>
        <parameter key="attribute" value="productSubCategory"/>
        <parameter key="from_attribute" value="from"/>
        <parameter key="to_attribute" value="to"/>
        <parameter key="use_regular_expressions" value="true"/>
      <connect from_port="input 1" to_op="Generate Attributes" to_port="example set input"/>
      <connect from_op="subcat_regex" from_port="output" to_op="Filter Examples" to_port="example set input"/>
      <connect from_op="Filter Examples" from_port="example set output" to_op="Replace (Dictionary)" to_port="dictionary"/>
      <connect from_op="Generate Attributes" from_port="example set output" to_op="Replace (Dictionary)" to_port="example set input"/>
      <connect from_op="Replace (Dictionary)" from_port="example set output" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="source_input 2" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>


  • Options
    MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,520 RM Data Scientist

    simply try == instead of =

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
Sign In or Register to comment.