push(new SparseInstance(instance.weight(), tempVals, tempInd, instance.numAttributes()));
inst = new SparseInstance(instance.weight(), tempVals, tempInd, instance.numAttributes()); } else { double[] vals = instance.toDoubleArray(); for (int j = 0; j < getInputFormat().numAttributes(); j++) { if (instance.attribute(j).isNumeric() && (!Instance.isMissingValue(vals[j]))) { if (Double.isNaN(m_MinArray[j]) || (m_MaxArray[j] == m_MinArray[j])) { vals[j] = 0; } else { vals[j] = (vals[j] - m_MinArray[j]) / (m_MaxArray[j] - m_MinArray[j]); } } } inst = new Instance(instance.weight(), vals);
  private void convertInstance(Instance instance) throws Exception {      if (!(instance instanceof SparseInstance)) {      double[] vals = instance.toDoubleArray();      for (int j = 0; j < getInputFormat().numAttributes(); j++) {	if (instance.attribute(j).isNumeric() &&	    (!Instance.isMissingValue(vals[j]))) {	  if (Double.isNaN(m_MinArray[j]) ||	      (m_MaxArray[j] == m_MinArray[j])) {	    vals[j] = 0;	  } else {	    vals[j] = (vals[j] - m_MinArray[j]) / 	      (m_MaxArray[j] - m_MinArray[j]);	  }	}      }	      push(new Instance(instance.weight(), vals));    } else {      double[] newVals = new double[instance.numAttributes()];      int[] newIndices = new int[instance.numAttributes()];      double[] vals = instance.toDoubleArray();      int ind = 0;      for (int j = 0; j < instance.numAttributes(); j++) {	double value;	if (instance.attribute(j).isNumeric() &&	    (!Instance.isMissingValue(vals[j]))) {	  if (Double.isNaN(m_MinArray[j]) ||	      (m_MaxArray[j] == m_MinArray[j])) {	    value = 0;	  } else {	    value = (vals[j] - m_MinArray[j]) / 	      (m_MaxArray[j] - m_MinArray[j]);	  }	  if (value != 0.0) {	    newVals[ind] = value;	    newIndices[ind] = j;	    ind++;	  }	} else {	  value = vals[j];	  if (value != 0.0) {	    newVals[ind] = value;	    newIndices[ind] = j;	    ind++;	  }	}      }	      double[] tempVals = new double[ind];      int[] tempInd = new int[ind];      System.arraycopy(newVals, 0, tempVals, 0, ind);      System.arraycopy(newIndices, 0, tempInd, 0, ind);      push(new SparseInstance(instance.weight(), tempVals, tempInd,			      instance.numAttributes()));    }  }