// Path: src/main/java/io/izenecloud/larser/feature/OnlineVectorWritable.java
// public class OnlineVectorWritable implements Writable {
// 	private Double offset;
// 	private Integer action;
// 	private Vector sample;
// 
// 	public OnlineVectorWritable() {
// 
// 	}
// 
// 	public OnlineVectorWritable(Double offset, Integer action, Vector sample) {
// 		this.offset = offset;
// 		this.action = action;
// 		this.sample = sample;
// 	}
// 
// 	public Double getOffset() {
// 		return offset;
// 	}
// 
// 	public Integer getOction() {
// 		return action;
// 	}
// 
// 	public Vector getSample() {
// 		return sample;
// 	}
// 
// 	public void write(DataOutput out) throws IOException {
// 		out.writeDouble(offset);
// 		out.writeInt(action);
// 		VectorWritable.writeVector(out, sample);
// 	}
// 
// 	public void readFields(DataInput in) throws IOException {
// 		offset = in.readDouble();
// 		action = in.readInt();
// 		sample = VectorWritable.readVector(in);
// 	}
// 
// }


import io.izenecloud.larser.feature.OnlineVectorWritable;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapreduce.Mapper;
import edu.stanford.nlp.optimization.QNMinimizer;
package io.izenecloud.lr;





public class LrIterationMapper extends
		Mapper<Text, ListWritable, String, LaserOnlineModel> {
	private static final double DEFAULT_REGULARIZATION_FACTOR = 0.000001f;

	private double regularizationFactor;
	private QNMinimizer lbfgs;

	protected void setup(Context context) throws IOException,
			InterruptedException {
		Configuration conf = context.getConfiguration();
		regularizationFactor = conf.getDouble(
				"lr.iteration.regulariztion.factor",
				DEFAULT_REGULARIZATION_FACTOR);
		lbfgs = new QNMinimizer();
		lbfgs.setRobustOptions();
	}

	protected void map(Text key, ListWritable valueWritable, Context context)
			throws IOException, InterruptedException {
		OnlineVectorWritable[] inputSplitData = new OnlineVectorWritable[valueWritable
				.get().size()];

		List<Writable> value = valueWritable.get();
		Iterator<Writable> iterator = value.iterator();
		int row = 0;
		while (iterator.hasNext()) {
// Path: src/main/java/io/izenecloud/larser/feature/OnlineVectorWritable.java
// public class OnlineVectorWritable implements Writable {
// 	private Double offset;
// 	private Integer action;
// 	private Vector sample;
// 
// 	public OnlineVectorWritable() {
// 
// 	}
// 
// 	public OnlineVectorWritable(Double offset, Integer action, Vector sample) {
// 		this.offset = offset;
// 		this.action = action;
// 		this.sample = sample;
// 	}
// 
// 	public Double getOffset() {
// 		return offset;
// 	}
// 
// 	public Integer getOction() {
// 		return action;
// 	}
// 
// 	public Vector getSample() {
// 		return sample;
// 	}
// 
// 	public void write(DataOutput out) throws IOException {
// 		out.writeDouble(offset);
// 		out.writeInt(action);
// 		VectorWritable.writeVector(out, sample);
// 	}
// 
// 	public void readFields(DataInput in) throws IOException {
// 		offset = in.readDouble();
// 		action = in.readInt();
// 		sample = VectorWritable.readVector(in);
// 	}
// 
// }


// Path: src/main/java/io/izenecloud/lr/LrIterationMapper.java
import io.izenecloud.larser.feature.OnlineVectorWritable;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapreduce.Mapper;
import edu.stanford.nlp.optimization.QNMinimizer;

package io.izenecloud.lr;





public class LrIterationMapper extends
		Mapper<Text, ListWritable, String, LaserOnlineModel> {
	private static final double DEFAULT_REGULARIZATION_FACTOR = 0.000001f;

	private double regularizationFactor;
	private QNMinimizer lbfgs;

	protected void setup(Context context) throws IOException,
			InterruptedException {
		Configuration conf = context.getConfiguration();
		regularizationFactor = conf.getDouble(
				"lr.iteration.regulariztion.factor",
				DEFAULT_REGULARIZATION_FACTOR);
		lbfgs = new QNMinimizer();
		lbfgs.setRobustOptions();
	}

	protected void map(Text key, ListWritable valueWritable, Context context)
			throws IOException, InterruptedException {
		OnlineVectorWritable[] inputSplitData = new OnlineVectorWritable[valueWritable
				.get().size()];

		List<Writable> value = valueWritable.get();
		Iterator<Writable> iterator = value.iterator();
		int row = 0;
		while (iterator.hasNext()) {
			OnlineVectorWritable v = ((OnlineVectorWritable) (iterator.next()));