public LambdaMeansPredictor(List<Instance> instances) {
		if (CommandLineUtilities.hasArg("cluster_lambda")) {
		    cluster_lambda = CommandLineUtilities.getOptionValueAsFloat("cluster_lambda");
		}
		clustering_training_iterations = 10;
		if (CommandLineUtilities.hasArg("clustering_training_iterations")) {
		    clustering_training_iterations = CommandLineUtilities.getOptionValueAsInt("clustering_training_iterations");
		}
		// init the first cluster. 
		FeatureVector mean = new FeatureVector();
		int count = 0;
		for (Instance instance : instances) {
			for (Entry<Integer, Double> entry : instance.getFeatureVector().getVector().entrySet()) {
				if (mean.containIndex(entry.getKey())) {
					mean.add(entry.getKey(), mean.get(entry.getKey())+entry.getValue());
				}
				else {
					mean.add(entry.getKey(),entry.getValue());
				}
			}
			// init assignments
			assignments.add(0);
			count ++;
		}
		for (Entry<Integer, Double> entry : mean.getVector().entrySet()) {
			mean.add(entry.getKey(), entry.getValue()/count);
		}
		clusters.add(mean);		
		// init lambda if it is not specified by the user.
		if (cluster_lambda == 0.0 && instances.size() != 0) {
			for (Instance instance : instances) {
				cluster_lambda += MathUtilities.SquaredL2Distance(mean, instance);
			}
			cluster_lambda /= instances.size();
			System.out.println("Lambda value is:" + cluster_lambda);
		}		
	}