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

[SOLVED] RapidMiner says "The example set has no examples" and I don't know why

CorneliusCornelius Member Posts: 2 Contributor I
Hallo,

I invoke RapidMiner in my Java Application like this:

final Random random = new Random();
final Object[][] data = new Object[5][5];
for (int i = 0; i < 5; ++i) {
for (int j = 0; j < 5; ++j) {
if (j == 0) {
data = "label" + random.nextInt();
} else {
data = random.nextInt();
}
}
}
final ExampleSet exampleSet = ExampleSetFactory.createExampleSet(data, 0);

RapidMiner.init();
final File process = new File("file.rmp");
final Process rapidMinerProcess = new Process(process);

final IOContainer ioContainer = rapidMinerProcess.run(new IOContainer(exampleSet));
But I get every time the following exception:
Exception in thread "main" com.rapidminer.operator.UserError: The example set has no examples
at com.rapidminer.example.Tools.isNonEmpty(Tools.java:469)
at com.rapidminer.operator.performance.PolynominalClassificationPerformanceEvaluator.checkCompatibility(PolynominalClassificationPerformanceEvaluator.java:105)
at com.rapidminer.operator.performance.AbstractPerformanceEvaluator.doWork(AbstractPerformanceEvaluator.java:234)
at com.rapidminer.operator.Operator.execute(Operator.java:834)
at com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:51)
at com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:711)
at com.rapidminer.operator.validation.ValidationChain.executeEvaluator(ValidationChain.java:223)
at com.rapidminer.operator.validation.ValidationChain.evaluate(ValidationChain.java:324)
at com.rapidminer.operator.validation.XValidation.performIteration(XValidation.java:162)
at com.rapidminer.operator.validation.XValidation.estimatePerformance(XValidation.java:151)
at com.rapidminer.operator.validation.ValidationChain.doWork(ValidationChain.java:273)
at com.rapidminer.operator.Operator.execute(Operator.java:834)
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:834)
at com.rapidminer.Process.run(Process.java:925)
at com.rapidminer.Process.run(Process.java:848)
at com.rapidminer.Process.run(Process.java:807)
at com.rapidminer.Process.run(Process.java:802)
My process is stored as XML and looks like this:
<?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="638" width="165">
     <operator activated="true" class="x_validation" compatibility="5.2.008" expanded="true" height="112" name="Validation" width="90" x="45" y="30">
       <process expanded="true" height="638" width="165">
         <operator activated="true" class="naive_bayes" compatibility="5.2.008" expanded="true" height="76" name="Naive Bayes" width="90" x="45" y="30"/>
         <connect from_port="training" to_op="Naive Bayes" to_port="training set"/>
         <connect from_op="Naive Bayes" 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="638" width="300">
         <operator activated="true" class="apply_model" compatibility="5.2.008" expanded="true" height="76" name="Apply Model" width="90" x="45" y="30">
           <list key="application_parameters"/>
         </operator>
         <operator activated="true" class="performance_classification" compatibility="5.2.008" expanded="true" height="76" name="Performance" width="90" x="180" y="30">
           <list key="class_weights"/>
         </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_op="Performance" to_port="labelled data"/>
         <connect from_op="Performance" 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="Validation" to_port="training"/>
     <connect from_op="Validation" from_port="averagable 1" 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>
Does anyone have an idea what's my mistake?

Thanks in advance.

Cornelius

Answers

  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi Cornelius,

    you are applying a 10-fold X-Validation on a dataset with 5 examples - that way of course some of the folds will be empty on the testing side. Just increase the number of examples, and your process will run fine.

    Happy Coding!
    ~Marius
  • CorneliusCornelius Member Posts: 2 Contributor I
    Oh! Of course. What a stupid mistake. Thanks a lot for your help.
Sign In or Register to comment.