m_perClass = new double [source.numClasses()]; m_perClassPerBag[0] = new double [source.numClasses()]; Enumeration enum = source.enumerateInstances(); while (enum.hasMoreElements()) add(0,(Instance) enum.nextElement());
  public Distribution(Instances source) throws Exception {        m_perClassPerBag = new double [1][0];    m_perBag = new double [1];    totaL = 0;    m_perClass = new double [source.numClasses()];    m_perClassPerBag[0] = new double [source.numClasses()];    Enumeration enum = source.enumerateInstances();    while (enum.hasMoreElements())      add(0,(Instance) enum.nextElement());  }  /**   * Creates a distribution according to given instances and   * split model.   *   * @exception Exception if something goes wrong   */  public Distribution(Instances source, 		      ClassifierSplitModel modelToUse)       throws Exception {    int index;    Instance instance;    double[] weights;    m_perClassPerBag = new double [modelToUse.numSubsets()][0];    m_perBag = new double [modelToUse.numSubsets()];    totaL = 0;    m_perClass = new double [source.numClasses()];    for (int i = 0; i < modelToUse.numSubsets(); i++)      m_perClassPerBag[i] = new double [source.numClasses()];    Enumeration enum = source.enumerateInstances();    while (enum.hasMoreElements()) {      instance = (Instance) enum.nextElement();      index = modelToUse.whichSubset(instance);      if (index != -1)	add(index, instance);      else {	weights = modelToUse.weights(instance);	addWeights(instance, weights);      }    }