buffer = new ArrayList<>(); for (int i = 0; i < n; i++) { TrainingExample example = new TrainingExample(); example.readFields(in); buffer.add(example);
@Override public void write(DataOutput out) throws IOException { out.writeInt(record); out.writeInt(cutoff); out.writeInt(minInterval); out.writeInt(maxInterval); out.writeInt(currentStep); out.writeInt(bufferSize); out.writeInt(buffer.size()); for (TrainingExample example : buffer) { example.write(out); } ep.write(out); best.write(out); out.writeInt(threadCount); out.writeInt(poolSize); seed.write(out); out.writeInt(numFeatures); out.writeBoolean(freezeSurvivors); }
adaptiveLogisticRegression.train(r.getKey(), r.getActual(), r.getInstance()); if (i % 1000 == 0 && adaptiveLogisticRegression.getBest() != null) { System.out.printf("%10d %10.4f %10.8f %.3f\n",
buffer = Lists.newArrayList(); for (int i = 0; i < n; i++) { TrainingExample example = new TrainingExample(); example.readFields(in); buffer.add(example);
buffer = Lists.newArrayList(); for (int i = 0; i < n; i++) { TrainingExample example = new TrainingExample(); example.readFields(in); buffer.add(example);
@Override public void write(DataOutput out) throws IOException { out.writeInt(record); out.writeInt(cutoff); out.writeInt(minInterval); out.writeInt(maxInterval); out.writeInt(currentStep); out.writeInt(bufferSize); out.writeInt(buffer.size()); for (TrainingExample example : buffer) { example.write(out); } ep.write(out); best.write(out); out.writeInt(threadCount); out.writeInt(poolSize); seed.write(out); out.writeInt(numFeatures); out.writeBoolean(freezeSurvivors); }
@Override public void write(DataOutput out) throws IOException { out.writeInt(record); out.writeInt(cutoff); out.writeInt(minInterval); out.writeInt(maxInterval); out.writeInt(currentStep); out.writeInt(bufferSize); out.writeInt(buffer.size()); for (TrainingExample example : buffer) { example.write(out); } ep.write(out); best.write(out); out.writeInt(threadCount); out.writeInt(poolSize); seed.write(out); out.writeInt(numFeatures); out.writeBoolean(freezeSurvivors); }
public void train(TrainingExample example) { wrapped.train(example.getKey(), example.getGroupKey(), example.getActual(), example.getInstance()); }
public void train(TrainingExample example) { wrapped.train(example.getKey(), example.getGroupKey(), example.getActual(), example.getInstance()); }
public void train(TrainingExample example) { wrapped.train(example.getKey(), example.getGroupKey(), example.getActual(), example.getInstance()); }
@Override public void train(long trackingKey, String groupKey, int actual, Vector instance) { record++; buffer.add(new TrainingExample(trackingKey, groupKey, actual, instance)); //don't train until we have enough examples if (buffer.size() > bufferSize) { trainWithBufferedExamples(); } }
private static AdaptiveLogisticRegression.TrainingExample getExample(int i, Random gen, Vector beta) { Vector data = new DenseVector(200); for (Vector.Element element : data.all()) { element.set(gen.nextDouble() < 0.3 ? 1 : 0); } double p = 1 / (1 + Math.exp(1.5 - data.dot(beta))); int target = 0; if (gen.nextDouble() < p) { target = 1; } return new AdaptiveLogisticRegression.TrainingExample(i, null, target, data); }
@Override public void train(long trackingKey, String groupKey, int actual, Vector instance) { record++; buffer.add(new TrainingExample(trackingKey, groupKey, actual, instance)); //don't train until we have enough examples if (buffer.size() > bufferSize) { trainWithBufferedExamples(); } }
@Override public void train(long trackingKey, String groupKey, int actual, Vector instance) { record++; buffer.add(new TrainingExample(trackingKey, groupKey, actual, instance)); //don't train until we have enough examples if (buffer.size() > bufferSize) { trainWithBufferedExamples(); } }