The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

i want to create a if statement

andy97andy97 Member Posts: 1 Learner I
if the payment method is cash the result will be bad and the another result will be good
the payment method is the regular attribute and the result in the data have cash and credit

Answers

  • rfuentealbarfuentealba RapidMiner Certified Analyst, Member, University Professor Posts: 568 Unicorn
    Hmmm, there are plenty of ways to do it. The simplest one would be using the Generate Attributes operator.

    Please, check the example I am attaching.



    The XML for this process is here:

    <?xml version="1.0" encoding="UTF-8"?><process version="9.5.000"><br>  <context><br>    <input/><br>    <output/><br>    <macros/><br>  </context><br>  <operator activated="true" class="process" compatibility="9.5.000" 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="dev-rfc83@protonmail.com"/><br>    <parameter key="process_duration_for_mail" value="30"/><br>    <parameter key="encoding" value="SYSTEM"/><br>    <process expanded="true"><br>      <operator activated="true" class="utility:create_exampleset" compatibility="9.5.000" expanded="true" height="68" name="Create ExampleSet" width="90" x="45" y="34"><br>        <parameter key="generator_type" value="comma separated text"/><br>        <parameter key="number_of_examples" value="100"/><br>        <parameter key="use_stepsize" value="false"/><br>        <list key="function_descriptions"/><br>        <parameter key="add_id_attribute" value="false"/><br>        <list key="numeric_series_configuration"/><br>        <list key="date_series_configuration"/><br>        <list key="date_series_configuration (interval)"/><br>        <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/><br>        <parameter key="time_zone" value="SYSTEM"/><br>        <parameter key="input_csv_text" value="price,payment&#10;100,cash&#10;200,cash&#10;100,credit&#10;200,credit&#10;100,cash&#10;300,credit&#10;"/><br>        <parameter key="column_separator" value=","/><br>        <parameter key="parse_all_as_nominal" value="false"/><br>        <parameter key="decimal_point_character" value="."/><br>        <parameter key="trim_attribute_names" value="true"/><br>      </operator><br>      <operator activated="true" class="generate_attributes" compatibility="9.5.000" expanded="true" height="82" name="Generate Attributes" width="90" x="179" y="34"><br>        <list key="function_descriptions"><br>          <parameter key="outcome" value="if (payment==&quot;cash&quot;,&quot;bad&quot;,&quot;good&quot;)"/><br>        </list><br>        <parameter key="keep_all" value="true"/><br>      </operator><br>      <connect from_op="Create ExampleSet" from_port="output" to_op="Generate Attributes" to_port="example set input"/><br>      <connect from_op="Generate Attributes" from_port="example set output" 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>

    Hope this helps,

    Rod.
Sign In or Register to comment.