indexer.init(parameters, reportMap);
/** * Trains a GIS model on the event in the specified event stream, using the specified number * of iterations and the specified count cutoff. * * @param eventStream A stream of all events. * @param iterations The number of iterations to use for GIS. * @param cutoff The number of times a feature must occur to be included. * @return A GIS model trained with specified */ public GISModel trainModel(ObjectStream<Event> eventStream, int iterations, int cutoff) throws IOException { DataIndexer indexer = new OnePassDataIndexer(); TrainingParameters indexingParameters = new TrainingParameters(); indexingParameters.put(GISTrainer.CUTOFF_PARAM, cutoff); indexingParameters.put(GISTrainer.ITERATIONS_PARAM, iterations); Map<String, String> reportMap = new HashMap<>(); indexer.init(indexingParameters, reportMap); indexer.index(eventStream); return trainModel(iterations, indexer); }
@Before public void setUp() throws Exception { indexer = new OnePassRealValueDataIndexer(); indexer.init(new TrainingParameters(Collections.emptyMap()), null); }
@Before public void initIndexer() { TrainingParameters trainingParameters = new TrainingParameters(); trainingParameters.put(AbstractTrainer.CUTOFF_PARAM, 1); testDataIndexer = new OnePassRealValueDataIndexer(); testDataIndexer.init(trainingParameters, new HashMap<>()); }
@Before public void initIndexer() { TrainingParameters trainingParameters = new TrainingParameters(); trainingParameters.put(AbstractTrainer.CUTOFF_PARAM, 1); testDataIndexer = new OnePassRealValueDataIndexer(); testDataIndexer.init(trainingParameters, new HashMap<>()); }
@Before public void initIndexer() { TrainingParameters trainingParameters = new TrainingParameters(); trainingParameters.put(AbstractTrainer.CUTOFF_PARAM, 1); indexer = new OnePassRealValueDataIndexer(); indexer.init(trainingParameters, new HashMap<>()); }
@Before public void initIndexer() { TrainingParameters trainingParameters = new TrainingParameters(); trainingParameters.put(AbstractTrainer.CUTOFF_PARAM, 1); testDataIndexer = new OnePassRealValueDataIndexer(); testDataIndexer.init(trainingParameters, new HashMap<>()); }
@Before public void initIndexer() { TrainingParameters trainingParameters = new TrainingParameters(); trainingParameters.put(AbstractTrainer.CUTOFF_PARAM, 0); testDataIndexer = new OnePassRealValueDataIndexer(); testDataIndexer.init(trainingParameters, new HashMap<>()); }
@Before public void initIndexer() { TrainingParameters trainingParameters = new TrainingParameters(); trainingParameters.put(AbstractTrainer.CUTOFF_PARAM, 1); trainingParameters.put(AbstractDataIndexer.SORT_PARAM, false);; testDataIndexer = new TwoPassDataIndexer(); testDataIndexer.init(trainingParameters, new HashMap<>()); }
@Before public void initIndexer() { TrainingParameters trainingParameters = new TrainingParameters(); trainingParameters.put(AbstractTrainer.CUTOFF_PARAM, 1); trainingParameters.put(AbstractDataIndexer.SORT_PARAM, false);; testDataIndexer = new TwoPassDataIndexer(); testDataIndexer.init(trainingParameters, new HashMap<>()); }
@Before public void initIndexer() { TrainingParameters trainingParameters = new TrainingParameters(); trainingParameters.put(AbstractTrainer.CUTOFF_PARAM, 1); trainingParameters.put(AbstractDataIndexer.SORT_PARAM, false); testDataIndexer = new TwoPassDataIndexer(); testDataIndexer.init(trainingParameters, new HashMap<>()); }
@Before public void initIndexer() { TrainingParameters trainingParameters = new TrainingParameters(); trainingParameters.put(AbstractTrainer.CUTOFF_PARAM, 1); trainingParameters.put(AbstractDataIndexer.SORT_PARAM, false);; testDataIndexer = new TwoPassDataIndexer(); testDataIndexer.init(trainingParameters, new HashMap<>()); }
@Before public void initIndexer() { TrainingParameters trainingParameters = new TrainingParameters(); trainingParameters.put(AbstractTrainer.CUTOFF_PARAM, 1); trainingParameters.put(AbstractDataIndexer.SORT_PARAM, false); testDataIndexer = new TwoPassDataIndexer(); testDataIndexer.init(trainingParameters, new HashMap<>()); }
@Test public void testQNOnPrepAttachData() throws IOException { DataIndexer 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()); AbstractModel model = new QNTrainer(true).trainModel(100, indexer ); PrepAttachDataUtil.testModel(model, 0.8155484030700668); }
@Test public void testIndexWithNewline() throws IOException { String[] sentence = "He belongs to Apache \n Software Foundation .".split(" "); NameContextGenerator CG = new DefaultNameContextGenerator( (AdaptiveFeatureGenerator[]) null); NameSample nameSample = new NameSample(sentence, new Span[] { new Span(3, 7) }, false); ObjectStream<Event> eventStream = new NameFinderEventStream( ObjectStreamUtils.createObjectStream(nameSample), "org", CG, null); DataIndexer indexer = new TwoPassDataIndexer(); indexer.init(new TrainingParameters(Collections.emptyMap()), null); indexer.index(eventStream); Assert.assertEquals(5, indexer.getContexts().length); } }
trainingParameters.put(AbstractDataIndexer.SORT_PARAM, false); DataIndexer di = new OnePassDataIndexer(); di.init(trainingParameters,reportMap); di.index(new SequenceStreamEventStream(sequenceStream)); numSequences = 0;
/** * Trains a GIS model on the event in the specified event stream, using the specified number * of iterations and the specified count cutoff. * * @param eventStream A stream of all events. * @param iterations The number of iterations to use for GIS. * @param cutoff The number of times a feature must occur to be included. * @return A GIS model trained with specified */ public GISModel trainModel(ObjectStream<Event> eventStream, int iterations, int cutoff) throws IOException { DataIndexer indexer = new OnePassDataIndexer(); TrainingParameters indexingParameters = new TrainingParameters(); indexingParameters.put(GISTrainer.CUTOFF_PARAM, cutoff); indexingParameters.put(GISTrainer.ITERATIONS_PARAM, iterations); Map<String, String> reportMap = new HashMap<>(); indexer.init(indexingParameters, reportMap); indexer.index(eventStream); return trainModel(iterations, indexer); }
/** * Trains a GIS model on the event in the specified event stream, using the specified number * of iterations and the specified count cutoff. * * @param eventStream A stream of all events. * @param iterations The number of iterations to use for GIS. * @param cutoff The number of times a feature must occur to be included. * @return A GIS model trained with specified */ public GISModel trainModel(ObjectStream<Event> eventStream, int iterations, int cutoff) throws IOException { DataIndexer indexer = new OnePassDataIndexer(); TrainingParameters indexingParameters = new TrainingParameters(); indexingParameters.put(GISTrainer.CUTOFF_PARAM, cutoff); indexingParameters.put(GISTrainer.ITERATIONS_PARAM, iterations); Map<String, String> reportMap = new HashMap<>(); indexer.init(indexingParameters, reportMap); indexer.index(eventStream); return trainModel(iterations, indexer); }
indexer.init(new TrainingParameters(Collections.emptyMap()), null); indexer.index(eventStream); Assert.assertEquals(3, indexer.getContexts().length);
indexer.init(new TrainingParameters(Collections.emptyMap()), null); indexer.index(eventStream); Assert.assertEquals(3, indexer.getContexts().length);