How to resolve this parsing error ?

shashwat01
shashwat01 Altair Community Member
edited November 5 in Community Q&A
How to resolve this parsing error ? Can you help me ?
Tagged:

Best Answer

  • jwpfau
    jwpfau New Altair Community Member
    Answer ✓
    Hi Shashwat,

    "8" is a number, "Single" is not a number.

    You can't use the Parse Number operator on this kind of data.

    Greetings,
    Jonas

Answers

  • jwpfau
    jwpfau New Altair Community Member
    Hi Shashwat,

    If you need numeric values you can i.e. use the "Nominal to Numerical" operator.

    Greetings,
    Jonas
  • shashwat01
    shashwat01 Altair Community Member
    Can you show me or can you elaborate the same ?
  • jwpfau
    jwpfau New Altair Community Member
    Hi Shashwat,

    The Nominal to Numerical operator allows you to encode Nominal values, like your "Married, Single, Together, Divorced, Widow" values into either Unique Integers like "0,1,2,3,4" or into a dummy encoding, which means new attributes with either 0 or 1 for each of the possible Nominal values.


    Here is an example processes that applies both methods onto your csv file:

    <?xml version="1.0" encoding="UTF-8"?><process version="10.3.001">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="10.3.001" expanded="true" name="Process">
        <parameter key="logverbosity" value="init"/>
        <parameter key="random_seed" value="2001"/>
        <parameter key="send_mail" value="never"/>
        <parameter key="notification_email" value=""/>
        <parameter key="process_duration_for_mail" value="30"/>
        <parameter key="encoding" value="SYSTEM"/>
        <process expanded="true">
          <operator activated="true" class="read_csv" compatibility="10.3.001" expanded="true" height="68" name="Read CSV" width="90" x="45" y="136">
            <parameter key="csv_file" value="https://us.v-cdn.net/6030995/uploads/editor/wi/9fdij6pl08ak.csv"/>
            <parameter key="column_separators" value=","/>
            <parameter key="trim_lines" value="false"/>
            <parameter key="multiline_text" value="false"/>
            <parameter key="use_quotes" value="true"/>
            <parameter key="quotes_character" value="&quot;"/>
            <parameter key="escape_character" value="\"/>
            <parameter key="skip_comments" value="true"/>
            <parameter key="comment_characters" value="#"/>
            <parameter key="starting_row" value="1"/>
            <parameter key="parse_numbers" value="true"/>
            <parameter key="decimal_character" value="."/>
            <parameter key="grouped_digits" value="false"/>
            <parameter key="grouping_character" value=","/>
            <parameter key="infinity_representation" value=""/>
            <parameter key="date_format" value="dd-MM-yyyy"/>
            <parameter key="use_header_row" value="true"/>
            <parameter key="header_row" value="1"/>
            <parameter key="first_row_as_names" value="true"/>
            <list key="annotations"/>
            <parameter key="time_zone" value="Europe/Berlin"/>
            <parameter key="locale" value="English (United States)"/>
            <parameter key="encoding" value="windows-1252"/>
            <parameter key="read_all_values_as_polynominal" value="false"/>
            <list key="data_set_meta_data_information">
              <parameter key="0" value="ID.true.integer.attribute"/>
              <parameter key="1" value="Year_Birth.true.integer.attribute"/>
              <parameter key="2" value="Education.true.polynominal.attribute"/>
              <parameter key="3" value="Marital_Status.true.polynominal.attribute"/>
              <parameter key="4" value="Income.true.integer.attribute"/>
              <parameter key="5" value="Kidhome.true.integer.attribute"/>
              <parameter key="6" value="Teenhome.true.integer.attribute"/>
              <parameter key="7" value="Dt_Customer.true.date.attribute"/>
              <parameter key="8" value="Recency.true.integer.attribute"/>
              <parameter key="9" value="MntWines.true.integer.attribute"/>
              <parameter key="10" value="MntFruits.true.integer.attribute"/>
              <parameter key="11" value="MntMeatProducts.true.integer.attribute"/>
              <parameter key="12" value="MntFishProducts.true.integer.attribute"/>
              <parameter key="13" value="MntSweetProducts.true.integer.attribute"/>
              <parameter key="14" value="MntGoldProds.true.integer.attribute"/>
              <parameter key="15" value="NumDealsPurchases.true.integer.attribute"/>
              <parameter key="16" value="NumWebPurchases.true.integer.attribute"/>
              <parameter key="17" value="NumCatalogPurchases.true.integer.attribute"/>
              <parameter key="18" value="NumStorePurchases.true.integer.attribute"/>
              <parameter key="19" value="NumWebVisitsMonth.true.integer.attribute"/>
              <parameter key="20" value="AcceptedCmp3.true.integer.attribute"/>
              <parameter key="21" value="AcceptedCmp4.true.integer.attribute"/>
              <parameter key="22" value="AcceptedCmp5.true.integer.attribute"/>
              <parameter key="23" value="AcceptedCmp1.true.integer.attribute"/>
              <parameter key="24" value="AcceptedCmp2.true.integer.attribute"/>
              <parameter key="25" value="Complain.true.integer.attribute"/>
              <parameter key="26" value="Response.true.integer.attribute"/>
            </list>
            <parameter key="read_not_matching_values_as_missings" value="false"/>
            <description align="center" color="transparent" colored="false" width="126">Read the CSV</description>
          </operator>
          <operator activated="true" class="blending:select_attributes" compatibility="10.3.001" expanded="true" height="82" name="Select Attributes" width="90" x="179" y="136">
            <parameter key="type" value="include attributes"/>
            <parameter key="attribute_filter_type" value="one attribute"/>
            <parameter key="select_attribute" value="Marital_Status"/>
            <parameter key="select_subset" value=""/>
            <parameter key="also_apply_to_special_attributes_(id,_label..)" value="false"/>
            <description align="center" color="transparent" colored="false" width="126">Only select the Maritial_Status</description>
          </operator>
          <operator activated="true" class="multiply" compatibility="10.3.001" expanded="true" height="103" name="Multiply" width="90" x="313" y="136"/>
          <operator activated="true" class="nominal_to_numerical" compatibility="10.3.001" expanded="true" height="103" name="Unique Integers (Nominal to Numerical)" width="90" x="514" y="238">
            <parameter key="return_preprocessing_model" value="false"/>
            <parameter key="attribute_filter_type" value="all"/>
            <parameter key="attribute" value=""/>
            <parameter key="attributes" value=""/>
            <parameter key="use_except_expression" value="false"/>
            <parameter key="value_type" value="nominal"/>
            <parameter key="use_value_type_exception" value="false"/>
            <parameter key="except_value_type" value="file_path"/>
            <parameter key="block_type" value="single_value"/>
            <parameter key="use_block_type_exception" value="false"/>
            <parameter key="except_block_type" value="single_value"/>
            <parameter key="invert_selection" value="false"/>
            <parameter key="include_special_attributes" value="false"/>
            <parameter key="coding_type" value="unique integers"/>
            <parameter key="use_comparison_groups" value="false"/>
            <list key="comparison_groups"/>
            <parameter key="unexpected_value_handling" value="all 0 and warning"/>
            <parameter key="use_underscore_in_name" value="false"/>
          </operator>
          <operator activated="true" class="nominal_to_numerical" compatibility="10.3.001" expanded="true" height="103" name="Dummy Encoding (Nominal to Numerical)" width="90" x="514" y="34">
            <parameter key="return_preprocessing_model" value="false"/>
            <parameter key="attribute_filter_type" value="all"/>
            <parameter key="attribute" value=""/>
            <parameter key="attributes" value=""/>
            <parameter key="use_except_expression" value="false"/>
            <parameter key="value_type" value="nominal"/>
            <parameter key="use_value_type_exception" value="false"/>
            <parameter key="except_value_type" value="file_path"/>
            <parameter key="block_type" value="single_value"/>
            <parameter key="use_block_type_exception" value="false"/>
            <parameter key="except_block_type" value="single_value"/>
            <parameter key="invert_selection" value="false"/>
            <parameter key="include_special_attributes" value="false"/>
            <parameter key="coding_type" value="dummy coding"/>
            <parameter key="use_comparison_groups" value="false"/>
            <list key="comparison_groups"/>
            <parameter key="unexpected_value_handling" value="all 0 and warning"/>
            <parameter key="use_underscore_in_name" value="false"/>
          </operator>
          <connect from_op="Read CSV" from_port="output" to_op="Select Attributes" to_port="example set input"/>
          <connect from_op="Select Attributes" from_port="example set output" to_op="Multiply" to_port="input"/>
          <connect from_op="Multiply" from_port="output 1" to_op="Dummy Encoding (Nominal to Numerical)" to_port="example set input"/>
          <connect from_op="Multiply" from_port="output 2" to_op="Unique Integers (Nominal to Numerical)" to_port="example set input"/>
          <connect from_op="Unique Integers (Nominal to Numerical)" from_port="example set output" to_port="result 2"/>
          <connect from_op="Dummy Encoding (Nominal to Numerical)" from_port="example set output" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
          <portSpacing port="sink_result 3" spacing="0"/>
        </process>
      </operator>
    </process>

    Greetings,
    Jonas
  • shashwat01
    shashwat01 Altair Community Member
    It is in XML format kindly provide the right format
  • jwpfau
    jwpfau New Altair Community Member
    Hi Shashwat,

    you can copy and paste the xml into the Process panel of RapidMiner Studio.

    This will replace your current process with the one from the XML, so please save your work first and start a new blank process first.

    Also see https://community.rapidminer.com/discussion/51369/how-can-i-share-rapidminer-studio-processes-online-or-with-other-people/p1

    Greetings,
    Jonas
  • Nicholas_21406
    Nicholas_21406
    Altair Employee
    Hi Shashwat, you will need to paste Jonas' XML text  into a program like Notepad, and then save it as a filename.rmp file, then you can import it into AI Studio.  These Community posts will not attach an rmp file, which is probably why Jonas did not send it to you.  Here, I am attaching a file containing Jonas' XML, named Jonas.xml.txt, which I can do because this post allows attachments of text files.  You can download Jonas.rmp.txt, rename it to Jonas.rmp and the import it into AI Studio.
  • shashwat01
    shashwat01 Altair Community Member
    I still face this error can u help me please 
  • jwpfau
    jwpfau New Altair Community Member
    Answer ✓
    Hi Shashwat,

    "8" is a number, "Single" is not a number.

    You can't use the Parse Number operator on this kind of data.

    Greetings,
    Jonas