public void Mstep(List<Instance> instances) {
		int insIndex = 0;
		List <Double> counts = new ArrayList<Double>();
		List <FeatureVector> newClusters = new ArrayList<FeatureVector>();
		// init the counts and new clusters.
		for (int i = 0 ; i < clusters.size() ; i++ ) {
			counts.add(0.0);
			newClusters.add(new FeatureVector());
		}
		// accumulate new clusters
		for (Instance instance : instances) {
			int assignment = assignments.get(insIndex);
			newClusters.get(assignment).add(instance);
			counts.set(assignment, counts.get(assignment)+1.0);
			insIndex ++;
		}
		int feaIndex = 0;
		for (FeatureVector cluster : newClusters) {
			cluster.scalarDivide(counts.get(feaIndex));
			feaIndex ++;
		}
		this.clusters = newClusters;
	}