@Override
	public void train(List<Instance> instances) {
		// initialize linearParam
		for (Instance instance : instances) {
			for (Entry<Integer, Double> entry : instance.getFeatureVector().getVector().entrySet()) {
				linearParam.add(entry.getKey(), 0.0);
			}
		}
		
		int iter = 0;
		while (iter < iters) {
			iter ++;
			for (Instance instance : instances) {
				double y = 2 * (Double.valueOf(instance.getLabel().toString()) - 0.5);
				if (MathUtilities.innerProduct(linearParam, instance)* y < 1) {
					for (Entry<Integer, Double> entry : instance.getFeatureVector().getVector().entrySet()) {
						linearParam.add(entry.getKey(), linearParam.get(entry.getKey()) + online_learning_rate * entry.getValue() * y);
					}
				}
			}
		}
	}