question: public final void addInstWithUnknown ( Instances source , int attIndex ) throws Exception { double [ ] probs ; double weight , newWeight ; int classIndex ; Instance instance ; int j ; probs = new double [ m_perBag . length ] ; for ( j = 0 ; j < m_perBag . length ; j ++ ) { if ( Utils . eq ( totaL , 0 ) ) { probs [ j ] = 1.0 / probs . length ; } else { probs [ j ] = m_perBag [ j ] / totaL ; } } Enumeration < Instance > enu = source . enumerateInstances ( ) ; while ( enu . hasMoreElements ( ) ) { instance = enu . nextElement ( ) ; if ( instance . isMissing ( attIndex ) ) { classIndex = ( int ) instance . classValue ( ) ; weight = instance . weight ( ) ; m_perClass [ classIndex ] = m_perClass [ classIndex ] + weight ; totaL = totaL + weight ; for ( j = 0 ; j < m_perBag . length ; j ++ ) { newWeight = probs [ j ] * weight ; m_perClassPerBag [ j ] [ classIndex ] = m_perClassPerBag [ j ] [ classIndex ] + newWeight ; m_perBag [ j ] = m_perBag [ j ] + newWeight ; } } } }
target:  Adds all instances with unknown values for given attribute, weighted according to frequency of instances in each bag.