// 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/ListWritable.java
// public class ListWritable implements Writable {
// 	private Class<? extends Writable> valueClass;
// 	private Class<? extends List> listClass;
// 	private List<Writable> values;
// 
// 	public ListWritable() {
// 	}
// 
// 	public ListWritable(List<Writable> values) {
// 		listClass = values.getClass();
// 		valueClass = values.get(0).getClass();
// 		this.values = values;
// 	}
// 
// 	public Class<? extends Writable> getValueClass() {
// 		return valueClass;
// 	}
// 
// 	@SuppressWarnings("rawtypes")
// 	public Class<? extends List> getListClass() {
// 		return listClass;
// 	}
// 
// 	public void set(List<Writable> values) {
// 		this.values = values;
// 	}
// 
// 	public List<Writable> get() {
// 		return values;
// 	}
// 
// 	@SuppressWarnings({ "unchecked", "rawtypes" })
// 	public void readFields(DataInput in) throws IOException {
// 		String listClass = in.readUTF();
// 		try {
// 			this.listClass = (Class<? extends List>) Class.forName(listClass);
// 			String valueClass = in.readUTF();
// 			this.valueClass = (Class<? extends Writable>) Class
// 					.forName(valueClass);
// 		} catch (ClassNotFoundException e1) {
// 			e1.printStackTrace();
// 		}
// 
// 		int size = in.readInt(); // construct values
// 		try {
// 			values = this.listClass.newInstance();
// 		} catch (InstantiationException e) {
// 			e.printStackTrace();
// 		} catch (IllegalAccessException e) {
// 			e.printStackTrace();
// 		}
// 		for (int i = 0; i < size; i++) {
// 			Writable value = WritableFactories.newInstance(this.valueClass);
// 			value.readFields(in); // read a value
// 			values.add(value); // store it in values
// 		}
// 	}
// 
// 	public void write(DataOutput out) throws IOException {
// 		out.writeUTF(listClass.getName());
// 		out.writeUTF(valueClass.getName());
// 		out.writeInt(values.size()); // write values
// 		Iterator<Writable> iterator = values.iterator();
// 		while (iterator.hasNext()) {
// 			iterator.next().write(out);
// 		}
// 	}
// 
// }


import io.izenecloud.larser.feature.OnlineVectorWritable;
import io.izenecloud.lr.ListWritable;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Counter;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
import org.apache.mahout.common.HadoopUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package io.izenecloud.larser.feature.online;




public class OnlineFeatureDriver {
	private static final Logger LOG = LoggerFactory
			.getLogger(OnlineFeatureDriver.class);

	public static long run(String collection, Path input, Path output,
			Configuration baseConf) throws IOException, ClassNotFoundException,
			InterruptedException {
		Configuration conf = new Configuration(baseConf);
		Job job = Job.getInstance(conf);

		job.setJarByClass(OnlineFeatureDriver.class);
		job.setJobName("GROUP each record's feature BY identifier");

		FileInputFormat.setInputPaths(job, input);
		FileOutputFormat.setOutputPath(job, output);

		job.setInputFormatClass(SequenceFileInputFormat.class);
		job.setOutputFormatClass(SequenceFileOutputFormat.class);

		job.setMapOutputKeyClass(Text.class);
// 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/ListWritable.java
// public class ListWritable implements Writable {
// 	private Class<? extends Writable> valueClass;
// 	private Class<? extends List> listClass;
// 	private List<Writable> values;
// 
// 	public ListWritable() {
// 	}
// 
// 	public ListWritable(List<Writable> values) {
// 		listClass = values.getClass();
// 		valueClass = values.get(0).getClass();
// 		this.values = values;
// 	}
// 
// 	public Class<? extends Writable> getValueClass() {
// 		return valueClass;
// 	}
// 
// 	@SuppressWarnings("rawtypes")
// 	public Class<? extends List> getListClass() {
// 		return listClass;
// 	}
// 
// 	public void set(List<Writable> values) {
// 		this.values = values;
// 	}
// 
// 	public List<Writable> get() {
// 		return values;
// 	}
// 
// 	@SuppressWarnings({ "unchecked", "rawtypes" })
// 	public void readFields(DataInput in) throws IOException {
// 		String listClass = in.readUTF();
// 		try {
// 			this.listClass = (Class<? extends List>) Class.forName(listClass);
// 			String valueClass = in.readUTF();
// 			this.valueClass = (Class<? extends Writable>) Class
// 					.forName(valueClass);
// 		} catch (ClassNotFoundException e1) {
// 			e1.printStackTrace();
// 		}
// 
// 		int size = in.readInt(); // construct values
// 		try {
// 			values = this.listClass.newInstance();
// 		} catch (InstantiationException e) {
// 			e.printStackTrace();
// 		} catch (IllegalAccessException e) {
// 			e.printStackTrace();
// 		}
// 		for (int i = 0; i < size; i++) {
// 			Writable value = WritableFactories.newInstance(this.valueClass);
// 			value.readFields(in); // read a value
// 			values.add(value); // store it in values
// 		}
// 	}
// 
// 	public void write(DataOutput out) throws IOException {
// 		out.writeUTF(listClass.getName());
// 		out.writeUTF(valueClass.getName());
// 		out.writeInt(values.size()); // write values
// 		Iterator<Writable> iterator = values.iterator();
// 		while (iterator.hasNext()) {
// 			iterator.next().write(out);
// 		}
// 	}
// 
// }


// Path: src/main/java/io/izenecloud/larser/feature/online/OnlineFeatureDriver.java
import io.izenecloud.larser.feature.OnlineVectorWritable;
import io.izenecloud.lr.ListWritable;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Counter;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
import org.apache.mahout.common.HadoopUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

package io.izenecloud.larser.feature.online;




public class OnlineFeatureDriver {
	private static final Logger LOG = LoggerFactory
			.getLogger(OnlineFeatureDriver.class);

	public static long run(String collection, Path input, Path output,
			Configuration baseConf) throws IOException, ClassNotFoundException,
			InterruptedException {
		Configuration conf = new Configuration(baseConf);
		Job job = Job.getInstance(conf);

		job.setJarByClass(OnlineFeatureDriver.class);
		job.setJobName("GROUP each record's feature BY identifier");

		FileInputFormat.setInputPaths(job, input);
		FileOutputFormat.setOutputPath(job, output);

		job.setInputFormatClass(SequenceFileInputFormat.class);
		job.setOutputFormatClass(SequenceFileOutputFormat.class);

		job.setMapOutputKeyClass(Text.class);
		job.setMapOutputValueClass(OnlineVectorWritable.class);