protected double[] getFinalClusterDistribution(Instance instance, int timeStep) throws Exception {
		int timeSteps = simpleKMeans.length;
		double[] finalClusterDistribution = new double[simpleKMeans[simpleKMeans.length - 1].getNumClusters()];
		for (int simulations = 0; simulations < 1000; simulations++) {
			int label = simpleKMeans[timeStep].clusterInstance(filterAttributes(instance));
			int prevState = label;
			for (int i = timeStep; i < timeSteps - 1; i++) {
				double[] cdf = new double[simpleKMeans[i + 1].getNumClusters()];
				double[][] transition = mm.get(i);
//				System.out.print(i + ":: size of transition = " + transition.length + "," + transition[0].length);
//				System.out.println(" :: cluster sizes = " + simpleKMeans[i].getNumClusters() + "," + simpleKMeans[i + 1].getNumClusters());
				cdf[0] = transition[prevState][0];
				for (int j = 1; j < cdf.length; j++) {
					cdf[j] = cdf[j - 1] + transition[prevState][j];
				}
				double rand = Math.random();
				int currState = -1;
				for (int j = 0; j < cdf.length; j++) {
					if (rand <= cdf[j]) {
						currState = j;
						break;
					}
				}
				prevState = currState;
			}
			finalClusterDistribution[prevState]++;
		}
		double total = 0;
		for (int i = 0; i < finalClusterDistribution.length; i++) {
			total += finalClusterDistribution[i];
		}
		for (int i = 0; i < finalClusterDistribution.length; i++) {
			finalClusterDistribution[i] /= total;
		}
		return finalClusterDistribution;
	}