private static Predictor train(List<Instance> instances, String algorithm) {
        if (instances==null || instances.size()==0) return null;

		// TODO Train the models using "algorithm" on "data"
        Predictor predictor = null;
        if (algorithm.equalsIgnoreCase("majority"))
            predictor = new MajorityPredictor();
        else if(algorithm.equalsIgnoreCase("even_odd"))
            predictor = new EvenOddPredictor();
        else if(algorithm.equalsIgnoreCase("logistic_regression"))
            predictor = new LogisticRegressionClassifier();
        else if(algorithm.equalsIgnoreCase("margin_perceptron"))
            predictor = new MarginPerceptronClassifier();
        else if(algorithm.equalsIgnoreCase("perceptron_linear_kernel")||
                algorithm.equalsIgnoreCase("perceptron_polynomial_kernel"))
            predictor = new DualPerceptronClassifier();
        else if(algorithm.equalsIgnoreCase("mira"))
            predictor = new MarginInfusedRelaxationClassifier();
        else
            return null;

        predictor.train(instances);

		// TODO Evaluate the models
        Evaluator evaluator = new AccuracyEvaluator();
        double accuracy = evaluator.evaluate(instances,predictor);
        System.out.println("train data accuracy is "+accuracy);

        return predictor;
	}