for (int i = 0; i < m_NumClusters; i++) {
HashMap initC = new HashMap(); DecisionTable.hashKey hk = null;  boolean centroidSearchBailOut = false; int i; for (i = 0; i < m_NumClusters; i++) { int centroidCount = 0;
  public void buildClusterer(Instances data) throws Exception {    m_Iterations = 0;    if (data.checkForStringAttributes()) {      throw  new Exception("Can't handle string attributes!");    }    m_ReplaceMissingFilter = new ReplaceMissingValues();    m_ReplaceMissingFilter.setInputFormat(data);    Instances instances = Filter.useFilter(data, m_ReplaceMissingFilter);    m_Min = new double [instances.numAttributes()];    m_Max = new double [instances.numAttributes()];    for (int i = 0; i < instances.numAttributes(); i++) {      m_Min[i] = m_Max[i] = Double.NaN;    }        m_ClusterCentroids = new Instances(instances, m_NumClusters);    int[] clusterAssignments = new int [instances.numInstances()];    for (int i = 0; i < instances.numInstances(); i++) {      updateMinMax(instances.instance(i));    }    Random RandomO = new Random(m_Seed);    boolean [] selected = new boolean[instances.numInstances()];    int instIndex;    for (int i = 0; i < m_NumClusters; i++) {      do {	instIndex = RandomO.nextInt(instances.numInstances());      } while (selected[instIndex]);      m_ClusterCentroids.add(instances.instance(instIndex));      selected[instIndex] = true;    }    selected = null;    boolean converged = false;    Instances [] tempI = new Instances[m_NumClusters];    while (!converged) {      m_Iterations++;      converged = true;      for (int i = 0; i < instances.numInstances(); i++) {	Instance toCluster = instances.instance(i);	int newC = clusterProcessedInstance(toCluster);	if (newC != clusterAssignments[i]) {	  converged = false;	}	clusterAssignments[i] = newC;	//	System.out.println(newC);      }            // update centroids      m_ClusterCentroids = new Instances(instances, m_NumClusters);      for (int i = 0; i < m_NumClusters; i++) {	tempI[i] = new Instances(instances, 0);      }      for (int i = 0; i < instances.numInstances(); i++) {	tempI[clusterAssignments[i]].add(instances.instance(i));      }      for (int i = 0; i < m_NumClusters; i++) {	double [] vals = new double[instances.numAttributes()];	for (int j = 0; j < instances.numAttributes(); j++) {	  vals[j] = tempI[i].meanOrMode(j);	}	m_ClusterCentroids.add(new Instance(1.0, vals));      }    }    m_ClusterStdDevs = new Instances(instances, m_NumClusters);    for (int i = 0; i < m_NumClusters; i++) {      double [] vals2 = new double[instances.numAttributes()];      for (int j = 0; j < instances.numAttributes(); j++) {	if (instances.attribute(j).isNumeric()) {	  vals2[j] = Math.sqrt(tempI[i].variance(j));	} else {	  vals2[j] = Instance.missingValue();	}      }      m_ClusterStdDevs.add(new Instance(1.0, vals2));    }  }