@Override public void buildClassifier(Database database,Relation<? extends ClassLabel> labelrep){
  TObjectIntMap<ClassLabel> count=new TObjectIntHashMap<>();
  for (DBIDIter iter=labelrep.iterDBIDs(); iter.valid(); iter.advance()) {
    count.adjustOrPutValue(labelrep.get(iter),1,1);
  }
  int max=Integer.MIN_VALUE;
  double size=labelrep.size();
  distribution=new double[count.size()];
  labels=new ArrayList<>(count.size());
  TObjectIntIterator<ClassLabel> iter=count.iterator();
  for (int i=0; iter.hasNext(); ++i) {
    iter.advance();
    distribution[i]=iter.value() / size;
    labels.add(iter.key());
    if (iter.value() > max) {
      max=iter.value();
      prediction=iter.key();
    }
  }
}

@ Override public void buildClassifier ( Database database , Relation < ? extends ClassLabel > labelrep ) { TObjectIntMap < ClassLabel > count = new TObjectIntHashMap < > ( ) ; for ( DBIDIter iter = labelrep . iterDBIDs ( ) ; iter . valid ( ) ; iter . advance ( ) ) { count . adjustOrPutValue ( labelrep . get ( iter ) , 1 , 1 ) ; } int max = Integer . MIN_VALUE ; double size = labelrep . size ( ) ; distribution = new double [ count . size ( ) ] ; labels = new ArrayList < > ( count . size ( ) ) ; TObjectIntIterator < ClassLabel > iter = count . iterator ( ) ; for ( int i = 0 ; iter . hasNext ( ) ; ++ i ) { iter . advance ( ) ; distribution [ i ] = iter . value ( ) / size ; labels . add ( iter . key ( ) ) ; if ( iter . value ( ) > max ) { max = iter . value ( ) ; prediction = iter . key ( ) ; } } }
learns the prior probability for all classes .
