public AbstractModel trainModel(int iterations, DataIndexer di, int cutoff) { return trainModel(iterations,di,cutoff,true); }
public AbstractModel trainModel(int iterations, DataIndexer di, int cutoff) { return trainModel(iterations,di,cutoff,true); }
public AbstractModel trainModel(int iterations, DataIndexer di, int cutoff) { return trainModel(iterations,di,cutoff,true); }
public AbstractModel doTrain(DataIndexer indexer) throws IOException { int iterations = getIterations(); int cutoff = getCutoff(); AbstractModel model; boolean useAverage = trainingParameters.getBooleanParameter("UseAverage", true); boolean useSkippedAveraging = trainingParameters.getBooleanParameter("UseSkippedAveraging", false); // overwrite otherwise it might not work if (useSkippedAveraging) useAverage = true; double stepSizeDecrease = trainingParameters.getDoubleParameter("StepSizeDecrease", 0); double tolerance = trainingParameters.getDoubleParameter("Tolerance", PerceptronTrainer.TOLERANCE_DEFAULT); this.setSkippedAveraging(useSkippedAveraging); if (stepSizeDecrease > 0) this.setStepSizeDecrease(stepSizeDecrease); this.setTolerance(tolerance); model = this.trainModel(iterations, indexer, cutoff, useAverage); return model; }
@Test public void testPerceptronOnPrepAttachData() throws IOException { TwoPassDataIndexer indexer = new TwoPassDataIndexer(); TrainingParameters indexingParameters = new TrainingParameters(); indexingParameters.put(AbstractTrainer.CUTOFF_PARAM, 1); indexingParameters.put(AbstractDataIndexer.SORT_PARAM, false); indexer.init(indexingParameters, new HashMap<>()); indexer.index(PrepAttachDataUtil.createTrainingStream()); MaxentModel model = new PerceptronTrainer().trainModel(400, indexer, 1); PrepAttachDataUtil.testModel(model, 0.7650408516959644); }
public AbstractModel doTrain(DataIndexer indexer) throws IOException { int iterations = getIterations(); int cutoff = getCutoff(); AbstractModel model; boolean useAverage = trainingParameters.getBooleanParameter("UseAverage", true); boolean useSkippedAveraging = trainingParameters.getBooleanParameter("UseSkippedAveraging", false); // overwrite otherwise it might not work if (useSkippedAveraging) useAverage = true; double stepSizeDecrease = trainingParameters.getDoubleParameter("StepSizeDecrease", 0); double tolerance = trainingParameters.getDoubleParameter("Tolerance", PerceptronTrainer.TOLERANCE_DEFAULT); this.setSkippedAveraging(useSkippedAveraging); if (stepSizeDecrease > 0) this.setStepSizeDecrease(stepSizeDecrease); this.setTolerance(tolerance); model = this.trainModel(iterations, indexer, cutoff, useAverage); return model; }
public AbstractModel doTrain(DataIndexer indexer) throws IOException { int iterations = getIterations(); int cutoff = getCutoff(); AbstractModel model; boolean useAverage = trainingParameters.getBooleanParameter("UseAverage", true); boolean useSkippedAveraging = trainingParameters.getBooleanParameter("UseSkippedAveraging", false); // overwrite otherwise it might not work if (useSkippedAveraging) useAverage = true; double stepSizeDecrease = trainingParameters.getDoubleParameter("StepSizeDecrease", 0); double tolerance = trainingParameters.getDoubleParameter("Tolerance", PerceptronTrainer.TOLERANCE_DEFAULT); this.setSkippedAveraging(useSkippedAveraging); if (stepSizeDecrease > 0) this.setStepSizeDecrease(stepSizeDecrease); this.setTolerance(tolerance); model = this.trainModel(iterations, indexer, cutoff, useAverage); return model; }