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

Set Role

aleatorioaleatorio Member Posts: 6 Contributor II
edited November 2018 in Help
Hi, I´m trying to run my own procces in java, the code is the following:
RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
        RapidMiner.init();
        Process p = new Process(new File("C:\\Users\\hugo\\Desktop\\ProyectoFinal\\SetRole.rmp"));
        IOContainer ioResult = p.run();

        // use the result(s) as needed, for example if your process just returns one ExampleSet, use this:
        if (ioResult.getElementAt(0) instanceof ExampleSet) {
            ExampleSet resultSet = (ExampleSet)ioResult.getElementAt(0);
            IOObject o= (IOObject)resultSet;
        }
but sometimes when i run it (Not always, and if I try to run it creating another project it also works) it gives me the following problem.
Información: The parameter '<code>attribute_name</code>' is unknown for operator '<var>Set Role</var>' (<code>Set Role</code>).
Mar 03, 2014 10:17:18 AM com.rapidminer.tools.WrapperLoggingHandler log
Información: No filename given for result file, using stdout for logging results!
Mar 03, 2014 10:17:18 AM com.rapidminer.Process run
Información: Process C:\Users\hugo\Desktop\ProyectoFinal\SetRole.rmp starts
Exception in thread "main" com.rapidminer.operator.UserError: The attribute '' does not exist.
at com.rapidminer.operator.preprocessing.filter.ChangeAttributeRole.setRole(ChangeAttributeRole.java:160)
at com.rapidminer.operator.preprocessing.filter.ChangeAttributeRole.apply(ChangeAttributeRole.java:143)
at com.rapidminer.operator.AbstractExampleSetProcessing.doWork(AbstractExampleSetProcessing.java:116)
at com.rapidminer.operator.Operator.execute(Operator.java:852)
at com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:51)
at com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:711)
at com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:379)
at com.rapidminer.operator.Operator.execute(Operator.java:852)
at com.rapidminer.Process.run(Process.java:949)
at com.rapidminer.Process.run(Process.java:873)
at com.rapidminer.Process.run(Process.java:832)
at com.rapidminer.Process.run(Process.java:827)
at com.rapidminer.Process.run(Process.java:817)
at proyecto.Proyecto.main(Proyecto.java:43)
Java Result: 1
I know it must seems i didn´t set the name of the attribute i want to change but i did.
Tagged:

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    can you please post the xml of the process you are executing?

    Regards,
    Marco
  • aleatorioaleatorio Member Posts: 6 Contributor II
    Yes of course, in this proccess i just open a file, divide it in different texts and finally parse them. The code is the following:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.013">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.013" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="text:read_document" compatibility="5.3.002" expanded="true" height="60" name="Read Document" width="90" x="45" y="30">
            <parameter key="file" value="C:\Users\hugo\Desktop\ProyectoFinal\reuters\reut2-000.sgm"/>
          </operator>
          <operator activated="true" class="text:cut_document" compatibility="5.3.002" expanded="true" height="60" name="Cut Document" width="90" x="179" y="30">
            <parameter key="query_type" value="Regular Region"/>
            <list key="string_machting_queries">
              <parameter key="all" value="&lt;REUTERS.&lt;/REUTERS&gt;"/>
            </list>
            <list key="regular_expression_queries">
              <parameter key="reuter" value="&lt;!ELEMENT REUTERS - - (DATE,(UNKNOWN|MKNOTE)*,TOPICS,PLACES,PEOPLE,ORGS,EXCHANGES,COMPANIES,UNKNOWN?,TEXT)&gt;"/>
            </list>
            <list key="regular_region_queries">
              <parameter key="reuter" value="&lt;REUTERS.&lt;/REUTERS&gt;"/>
            </list>
            <list key="xpath_queries">
              <parameter key="reuter" value="//DATE"/>
            </list>
            <list key="namespaces"/>
            <parameter key="assume_html" value="false"/>
            <list key="index_queries"/>
            <process expanded="true">
              <operator activated="true" class="text:replace_tokens" compatibility="5.3.002" expanded="true" height="60" name="Replace Tokens (2)" width="90" x="45" y="30">
                <list key="replace_dictionary">
                  <parameter key="&lt;/D&gt;" value=" "/>
                </list>
              </operator>
              <operator activated="true" class="text:remove_document_parts" compatibility="5.3.002" expanded="true" height="60" name="Remove Document Parts (10)" width="90" x="179" y="30">
                <parameter key="deletion_regex" value="&lt;D&gt;"/>
              </operator>
              <operator activated="true" class="text:extract_information" compatibility="5.3.002" expanded="true" height="60" name="Extract Information (2)" width="90" x="315" y="30">
                <list key="string_machting_queries">
                  <parameter key="topics" value="&lt;TOPICS&gt;.&lt;/TOPICS&gt;"/>
                </list>
                <list key="regular_expression_queries"/>
                <list key="regular_region_queries"/>
                <list key="xpath_queries"/>
                <list key="namespaces"/>
                <list key="index_queries"/>
              </operator>
              <operator activated="true" class="text:remove_document_parts" compatibility="5.3.002" expanded="true" height="60" name="Remove Document Parts (11)" width="90" x="450" y="30">
                <parameter key="deletion_regex" value="^.*?(?=&lt;TITLE&gt;)&lt;TITLE&gt;"/>
              </operator>
              <operator activated="true" class="text:remove_document_parts" compatibility="5.3.002" expanded="true" height="60" name="Remove Document Parts (12)" width="90" x="585" y="30">
                <parameter key="deletion_regex" value="&lt;/TITLE&gt;"/>
              </operator>
              <operator activated="true" class="text:remove_document_parts" compatibility="5.3.002" expanded="true" height="60" name="Remove Document Parts (13)" width="90" x="45" y="120">
                <parameter key="deletion_regex" value="&lt;DATELINE&gt;"/>
              </operator>
              <operator activated="true" class="text:remove_document_parts" compatibility="5.3.002" expanded="true" height="60" name="Remove Document Parts (14)" width="90" x="179" y="120">
                <parameter key="deletion_regex" value="&lt;/DATELINE&gt;"/>
              </operator>
              <operator activated="true" class="text:remove_document_parts" compatibility="5.3.002" expanded="true" height="60" name="Remove Document Parts (15)" width="90" x="313" y="120">
                <parameter key="deletion_regex" value="&lt;AUTHOR&gt;"/>
              </operator>
              <operator activated="true" class="text:remove_document_parts" compatibility="5.3.002" expanded="true" height="60" name="Remove Document Parts (16)" width="90" x="450" y="120">
                <parameter key="deletion_regex" value="&lt;/AUTHOR&gt;"/>
              </operator>
              <operator activated="true" class="text:remove_document_parts" compatibility="5.3.002" expanded="true" height="60" name="Remove Document Parts (17)" width="90" x="585" y="120">
                <parameter key="deletion_regex" value="&lt;BODY&gt;"/>
              </operator>
              <operator activated="true" class="text:remove_document_parts" compatibility="5.3.002" expanded="true" height="60" name="Remove Document Parts (18)" width="90" x="581" y="210">
                <parameter key="deletion_regex" value="&amp;#3;.*"/>
              </operator>
              <connect from_port="segment" to_op="Replace Tokens (2)" to_port="document"/>
              <connect from_op="Replace Tokens (2)" from_port="document" to_op="Remove Document Parts (10)" to_port="document"/>
              <connect from_op="Remove Document Parts (10)" from_port="document" to_op="Extract Information (2)" to_port="document"/>
              <connect from_op="Extract Information (2)" from_port="document" to_op="Remove Document Parts (11)" to_port="document"/>
              <connect from_op="Remove Document Parts (11)" from_port="document" to_op="Remove Document Parts (12)" to_port="document"/>
              <connect from_op="Remove Document Parts (12)" from_port="document" to_op="Remove Document Parts (13)" to_port="document"/>
              <connect from_op="Remove Document Parts (13)" from_port="document" to_op="Remove Document Parts (14)" to_port="document"/>
              <connect from_op="Remove Document Parts (14)" from_port="document" to_op="Remove Document Parts (15)" to_port="document"/>
              <connect from_op="Remove Document Parts (15)" from_port="document" to_op="Remove Document Parts (16)" to_port="document"/>
              <connect from_op="Remove Document Parts (16)" from_port="document" to_op="Remove Document Parts (17)" to_port="document"/>
              <connect from_op="Remove Document Parts (17)" from_port="document" to_op="Remove Document Parts (18)" to_port="document"/>
              <connect from_op="Remove Document Parts (18)" from_port="document" to_port="document 1"/>
              <portSpacing port="source_segment" spacing="0"/>
              <portSpacing port="sink_document 1" spacing="0"/>
              <portSpacing port="sink_document 2" spacing="0"/>
            </process>
          </operator>
          <operator activated="true" class="text:process_documents" compatibility="5.3.002" expanded="true" height="94" name="Process Documents (2)" width="90" x="313" y="30">
            <process expanded="true">
              <operator activated="true" class="text:transform_cases" compatibility="5.3.002" expanded="true" height="60" name="Transform Cases (2)" width="90" x="45" y="30"/>
              <operator activated="true" class="text:tokenize" compatibility="5.3.002" expanded="true" height="60" name="Tokenize (2)" width="90" x="180" y="30"/>
              <operator activated="true" class="text:filter_stopwords_english" compatibility="5.3.002" expanded="true" height="60" name="Filter Stopwords (2)" width="90" x="315" y="30"/>
              <operator activated="true" class="text:filter_by_length" compatibility="5.3.002" expanded="true" height="60" name="Filter Tokens (2)" width="90" x="450" y="30">
                <parameter key="max_chars" value="20"/>
              </operator>
              <operator activated="true" class="text:stem_porter" compatibility="5.3.002" expanded="true" height="60" name="Stem (2)" width="90" x="605" y="30"/>
              <connect from_port="document" to_op="Transform Cases (2)" to_port="document"/>
              <connect from_op="Transform Cases (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_op="Stem (2)" to_port="document"/>
              <connect from_op="Stem (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="set_role" compatibility="5.3.013" expanded="true" height="76" name="Set Role" width="90" x="447" y="30">
            <parameter key="attribute_name" value="topics"/>
            <parameter key="target_role" value="label"/>
            <list key="set_additional_roles"/>
          </operator>
          <connect from_op="Read Document" from_port="output" to_op="Cut Document" to_port="document"/>
          <connect from_op="Cut Document" from_port="documents" to_op="Process Documents (2)" to_port="documents 1"/>
          <connect from_op="Process Documents (2)" from_port="example set" to_op="Set Role" to_port="example set input"/>
          <connect from_op="Set Role" 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"/>
        </process>
      </operator>
    </process>
    It gives me a warning in set Role but i was not able to solve it and i works anyway.
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    quite strange. I have to admint that I do not know what might cause the problem I'm afraid..

    Regards,
    Marco
  • aleatorioaleatorio Member Posts: 6 Contributor II
    Thanks for answering  :), i´ll just use it without knowing that problem.

    Regards.
Sign In or Register to comment.