"Text Mining / Process documents"

IPenna
IPenna New Altair Community Member
edited November 5 in Community Q&A
Hello,

I'm trying to make a text classification modeling and I'm using the following processes:

1)Read Excel
2)Data to documents
3)Process documents
4)Validation

The problem a get is in the validation process. I receive a mensage tha i don't have a label atribbute althought I have the following structure in my data::
              Column1                      Column2        Column3       
ROW 1      ID (ID)              attribute (text)      LABEL(binomial)


To make a test I've put a SELECT ATRIBUTES operator after the Read  Excel and I'm able to see the tree atributes. When I use the Select atributes operator after the Process Documents operator i canot select any atribute (the same occurs when i put after the Data to documents operators).
?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.008">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.2.008" expanded="true" name="Process">
    <process expanded="true" height="449" width="681">
      <operator activated="true" class="read_excel" compatibility="5.2.008" expanded="true" height="60" name="Read Excel" width="90" x="45" y="30">
        <parameter key="excel_file" value="C:\Documents and Settings\igor.penna\Desktop\OFICIAL2.xlsx"/>
        <parameter key="sheet_number" value="3"/>
        <parameter key="imported_cell_range" value="A1:C41"/>
        <parameter key="first_row_as_names" value="false"/>
        <list key="annotations">
          <parameter key="0" value="Name"/>
        </list>
        <list key="data_set_meta_data_information">
          <parameter key="0" value="ID.true.integer.id"/>
          <parameter key="1" value="HISTORICO.true.text.attribute"/>
          <parameter key="2" value="CLASSIFICACAO.true.binominal.label"/>
        </list>
        <parameter key="read_not_matching_values_as_missings" value="false"/>
        <parameter key="datamanagement" value="double_sparse_array"/>
      </operator>
      <operator activated="true" class="text:data_to_documents" compatibility="5.3.000" expanded="true" height="60" name="Data to Documents" width="90" x="45" y="165">
        <list key="specify_weights"/>
      </operator>
      <operator activated="true" class="text:process_documents" compatibility="5.3.000" expanded="true" height="94" name="Process Documents" width="90" x="45" y="300">
        <parameter key="prune_below_absolute" value="2"/>
        <parameter key="prune_above_absolute" value="999"/>
        <process expanded="true" height="412" width="688">
          <operator activated="true" class="text:transform_cases" compatibility="5.3.000" expanded="true" height="60" name="Transform Cases (2)" width="90" x="36" y="25"/>
          <operator activated="true" class="text:replace_tokens" compatibility="5.3.000" expanded="true" height="60" name="Replace Tokens (2)" width="90" x="45" y="120">
            <list key="replace_dictionary">
              <parameter key="anv" value="aeronave"/>
              <parameter key="nº" value="número"/>
            </list>
          </operator>
          <operator activated="true" class="text:tokenize" compatibility="5.3.000" expanded="true" height="60" name="Tokenize (2)" width="90" x="45" y="210"/>
          <operator activated="true" class="text:filter_stopwords_dictionary" compatibility="5.3.000" expanded="true" height="76" name="Filter Stopwords (2)" width="90" x="45" y="300">
            <parameter key="file" value="C:\Documents and Settings\igor.penna\Desktop\dicionario de exclusões.txt"/>
          </operator>
          <operator activated="true" class="text:filter_by_length" compatibility="5.3.000" expanded="true" height="60" name="Filter Tokens (2)" width="90" x="246" y="30">
            <parameter key="min_chars" value="2"/>
            <parameter key="max_chars" value="999"/>
          </operator>
          <connect from_port="document" to_op="Transform Cases (2)" to_port="document"/>
          <connect from_op="Transform Cases (2)" from_port="document" to_op="Replace Tokens (2)" to_port="document"/>
          <connect from_op="Replace Tokens (2)" from_port="document" to_op="Tokenize (2)" to_port="document"/>
          <connect from_op="Tokenize (2)" from_port="document" to_op="Filter Stopwords (2)" to_port="document"/>
          <connect from_op="Filter Stopwords (2)" from_port="document" to_op="Filter Tokens (2)" to_port="document"/>
          <connect from_op="Filter Tokens (2)" from_port="document" to_port="document 1"/>
          <portSpacing port="source_document" spacing="0"/>
          <portSpacing port="sink_document 1" spacing="0"/>
          <portSpacing port="sink_document 2" spacing="0"/>
        </process>
      </operator>
      <operator activated="true" class="x_validation" compatibility="5.2.008" expanded="true" height="112" name="Validation" width="90" x="380" y="210">
        <process expanded="true" height="412" width="319">
          <operator activated="false" class="k_nn" compatibility="5.2.008" expanded="true" height="76" name="k-NN" width="90" x="112" y="30">
            <parameter key="k" value="3"/>
            <parameter key="measure_types" value="NumericalMeasures"/>
            <parameter key="numerical_measure" value="CosineSimilarity"/>
          </operator>
          <connect from_port="training" to_op="k-NN" to_port="training set"/>
          <connect from_op="k-NN" from_port="model" to_port="model"/>
          <portSpacing port="source_training" spacing="0"/>
          <portSpacing port="sink_model" spacing="0"/>
          <portSpacing port="sink_through 1" spacing="0"/>
        </process>
        <process expanded="true" height="412" width="319">
          <operator activated="false" class="apply_model" compatibility="5.2.008" expanded="true" height="76" name="Apply Model" width="90" x="112" y="30">
            <list key="application_parameters"/>
          </operator>
          <connect from_port="model" to_op="Apply Model" to_port="model"/>
          <connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/>
          <connect from_op="Apply Model" from_port="labelled data" to_port="averagable 1"/>
          <portSpacing port="source_model" spacing="0"/>
          <portSpacing port="source_test set" spacing="0"/>
          <portSpacing port="source_through 1" spacing="0"/>
          <portSpacing port="sink_averagable 1" spacing="0"/>
          <portSpacing port="sink_averagable 2" spacing="0"/>
        </process>
      </operator>
      <connect from_port="input 1" to_op="Read Excel" to_port="file"/>
      <connect from_op="Read Excel" from_port="output" to_op="Data to Documents" to_port="example set"/>
      <connect from_op="Data to Documents" from_port="documents" to_op="Process Documents" to_port="documents 1"/>
      <connect from_op="Process Documents" from_port="example set" to_op="Validation" to_port="training"/>
      <connect from_op="Validation" from_port="model" 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"/>
    </process>
  </operator>
</process>
Thank you

Answers

  • MariusHelf
    MariusHelf New Altair Community Member
    First of all you are using RapidMiner 5.2.8 - this version is very old, please upgrade to the latest version 5.3.12.

    Do you know breakpoints? If you set a breakpoint on an operator, the process stops after that operator such that you can investigate the results.

    If Select Attributes does not show the attributes you want to select, you can simply type them into the field with the keyboard.

    To solve your problem you could try to remove the connection that comes in from the left to the Read Excel operator, and select the file you want to import via the wizard (if you have not done so already).

    Good luck!

    ~Marius