[SOLVED] How to get distribution table model of naive bayes?

anonimoper
anonimoper New Altair Community Member
edited November 5 in Community Q&A
Hi, i want to get distribution table model of naive bayes. I use eclipse but i don't get distribution table model. I get performance vector.

This is code:

package fdf;

import com.rapidminer.RapidMiner;
import com.rapidminer.Process;
import com.rapidminer.example.Attribute;
import com.rapidminer.example.Example;
import com.rapidminer.example.ExampleSet;
import com.rapidminer.operator.IOContainer;
import com.rapidminer.operator.IOObject;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.operator.Model;




import java.io.File;
import java.io.IOException;
import java.util.Iterator;

import com.rapidminer.operator.io.ExcelExampleSource;
import com.rapidminer.operator.learner.bayes.DistributionModel;
import com.rapidminer.repository.IOObjectEntry;
import com.rapidminer.repository.ProcessEntry;
import com.rapidminer.repository.RepositoryLocation;
import com.rapidminer.tools.XMLException;

public class Prueba {

public static void main(String args[]) throws OperatorException, IOException, XMLException {

   RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
   System.setProperty("rapidminer.home", "C:\\Users\\lDanny\\workspace\\rapidminer-5.3.013\\rapidminer");
   RapidMiner.init();
   
   Process location = new Process(new File("C:\\Users\\lDanny\\.RapidMiner5\\repositories\\Local Repository\\PrimeraVez.rmp"));
   IOContainer resultExample = location.run();
   
   System.out.println(resultExample.toString());
System.out.println("am here");
}
}

this is result:

IOContainer (3 objects):
SimpleExampleSet:
32 examples,
1778 regular attributes,
special attributes = {
   label = #0: categoria (nominal/single_value)/values=[H.1.2, H.3.3]
}
(created by Set Role)
Distribution model for label attribute categoria


Class H.1.2 (0.875)
1778 distributions

Class H.3.3 (0.125)
1778 distributions

(created by Naive Bayes)

PerformanceVector [
-----accuracy: 100.00% +/- 0.00% (mikro: 100.00%)
ConfusionMatrix:
True: H.1.2 H.3.3
H.1.2: 28 0
H.3.3: 0 4
-----precision: 100.00% (positive class: H.3.3)
ConfusionMatrix:
True: H.1.2 H.3.3
H.1.2: 28 0
H.3.3: 0 4
-----recall: 100.00% (positive class: H.3.3)
ConfusionMatrix:
True: H.1.2 H.3.3
H.1.2: 28 0
H.3.3: 0 4
-----AUC (optimistic): 0.900 +/- 0.200 (mikro: 0.900) (positive class: H.3.3)
-----AUC: 0.500 +/- 0.000 (mikro: 0.500) (positive class: H.3.3)
-----AUC (pessimistic): 0.900 +/- 0.200 (mikro: 0.900) (positive class: H.3.3)
]
(created by Performance (2))

i want to get this:http://www.subirimagenes.net/i/140502022203717274.png

Answers

  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    you want your second result, the DistributionModel. You can then pass that to the  DistributionTableModel(DistributionModel model) constructor which is an AbstractTableModel. You then have the table model you want.

    Regards,
    Marco
  • anonimoper
    anonimoper New Altair Community Member
    Thanks, but i how get DistributionTableModel?

    IOContainer resultExample = location.run();

    resultExample haven't DistributionTableModel, or i must not to use IOContainer?.
    Thanks.

  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    no you have to create the DistributionTableModel yourself. The result only contains the DistributionModel.

    Regards,
    Marco
  • anonimoper
    anonimoper New Altair Community Member
    Him thanks very much, I create DistributionTableModelRender and it's ok.
    Thanks.