🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

RapidMiner/Netbeans problem.

User: "Reem"
New Altair Community Member
Updated by Jocelyn
Hi,

I am working on text classification project, I was trying to integrate the model I built in Rapidminer GUI but I have problems in the code which I couldn't solve to move on!

- I'm using rapid miner 5.3.015
- I added all rapid miner jars to the netbean project
- I am beginner user.
- here is my xml file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="text:process_document_from_file" compatibility="5.3.002" expanded="true" height="76" name="Process Documents from Files (3)" width="90" x="179" y="75">
        <list key="text_directories">
          <parameter key="Tourist" value="W:\NormalizedFiles\TouristAndTravel"/>
          <parameter key="Science" value="W:\NormalizedFiles\Science"/>
        </list>
        <process expanded="true">
          <operator activated="true" class="text:tokenize" compatibility="5.3.002" expanded="true" height="60" name="Tokenize (3)" width="90" x="45" y="30"/>
          <operator activated="true" class="text:filter_stopwords_arabic" compatibility="5.3.002" expanded="true" height="60" name="Filter Stopwords (3)" width="90" x="180" y="30"/>
          <operator activated="true" class="text:stem_arabic" compatibility="5.3.002" expanded="true" height="60" name="Stem (3)" width="90" x="409" y="30"/>
          <connect from_port="document" to_op="Tokenize (3)" to_port="document"/>
          <connect from_op="Tokenize (3)" from_port="document" to_op="Filter Stopwords (3)" to_port="document"/>
          <connect from_op="Filter Stopwords (3)" from_port="document" to_op="Stem (3)" to_port="document"/>
          <connect from_op="Stem (3)" 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="parallel:x_validation_parallel" compatibility="5.3.000" expanded="true" height="112" name="KNNValidation" width="90" x="449" y="30">
        <process expanded="true">
          <operator activated="true" class="k_nn" compatibility="5.3.015" expanded="true" height="76" name="k-NN" width="90" x="102" y="30"/>
          <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">
          <operator activated="true" class="apply_model" compatibility="5.3.015" expanded="true" height="76" name="Apply Model (2)" width="90" x="45" y="30">
            <list key="application_parameters"/>
          </operator>
          <operator activated="true" class="performance" compatibility="5.3.015" expanded="true" height="76" name="Performance (2)" width="90" x="187" y="30"/>
          <connect from_port="model" to_op="Apply Model (2)" to_port="model"/>
          <connect from_port="test set" to_op="Apply Model (2)" to_port="unlabelled data"/>
          <connect from_op="Apply Model (2)" from_port="labelled data" to_op="Performance (2)" to_port="labelled data"/>
          <connect from_op="Performance (2)" from_port="performance" 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="Process Documents from Files (3)" to_port="word list"/>
      <connect from_op="Process Documents from Files (3)" from_port="example set" to_op="KNNValidation" to_port="training"/>
      <connect from_op="KNNValidation" 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>
and here is my initial trials:
Following the API documentation:
    public static void main(String[] args) {
        try {
            RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
            RapidMiner.init();

            Process process = new Process(new File("W:/RapidMinerRepository/textKNNClassifier.rmp"));
            process.run();

        } catch (IOException | XMLException | OperatorException ex) {
            ex.printStackTrace();
        }
    }
In this code there is no editor errors but it showed me this error: com.rapidminer.parameter.UndefinedParameterError: A value for the parameter 'operatorName' must be specified!
So, I couldn't figure where is the problem exactly!
Another trial following this thread: http://rapid-i.com/rapidforum/index.php/topic,3862.msg14364.html#msg14364
    public static void main(String[] args) throws MalformedRepositoryLocationException, RepositoryException {
        // this initializes RapidMiner with your repositories available
        RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
        RapidMiner.init();

        // loads the process from the repository
        RepositoryLocation pLoc = new RepositoryLocation("W:/RapidMinerRepository/textKNNClassifier.rmp");
        ProcessEntry pEntry = (ProcessEntry) pLoc.locateEntry();
        String processXML = pEntry.retrieveXML();
        Process myProcess = new Process(processXML); //error
       
        // execute the process and get the resulting objects
        IOContainer ioInput = new IOContainer(new IOObject[] {myIOObject});
        myProcess.run();  //error
    }
errors shown by netbean editor are for words creating Process object and calling run() method
So, any idea how to solve this problem?
Thanks in advance :)

Find more posts tagged with