@Override public double[] getDistribution(Instance inst, Attribute classAtt) throws Exception { // totalWeight - m_weightSeenAtLastSplitEval is the weight mass // observed by this node's NB model boolean doNB = m_nbWeightThreshold == 0 ? true : (totalWeight() - m_weightSeenAtLastSplitEval > m_nbWeightThreshold); if (doNB) { return m_bayes.distributionForInstance(inst); } return super.getDistribution(inst, classAtt); }
@Override public double[] getDistribution(Instance inst, Attribute classAtt) throws Exception { // totalWeight - m_weightSeenAtLastSplitEval is the weight mass // observed by this node's NB model boolean doNB = m_nbWeightThreshold == 0 ? true : (totalWeight() - m_weightSeenAtLastSplitEval > m_nbWeightThreshold); if (doNB) { return m_bayes.distributionForInstance(inst); } return super.getDistribution(inst, classAtt); }
/** * Return the probability for a class value * * @param classIndex the index of the class value * @param instance the instance to generate a probability for * @param theSubset the subset to consider * @return a probability * @exception Exception if an error occurs */ public double classProb(int classIndex, Instance instance, int theSubset) throws Exception { m_disc.input(instance); Instance temp = m_disc.output(); return m_nb.distributionForInstance(temp)[classIndex]; }
/** * Return the probability for a class value * * @param classIndex the index of the class value * @param instance the instance to generate a probability for * @param theSubset the subset to consider * @return a probability * @exception Exception if an error occurs */ public double classProb(int classIndex, Instance instance, int theSubset) throws Exception { m_disc.input(instance); Instance temp = m_disc.output(); return m_nb.distributionForInstance(temp)[classIndex]; }