Exemplo n.º 1
0
        public void TrainModel()
        {
            StreamReader trainingReader = new StreamReader(testPath);
            GisModel     model;

            ITrainingEventReader eventReader = new BasicEventReader(new PlainTextByLineDataReader(trainingReader));
            GisTrainer           trainer     = new GisTrainer();

            trainer.TrainModel(eventReader);
            model = new GisModel(trainer);

            string modelDataFile = testPath.Replace(".txt", ".nbin"); // + ".nbin";

            IO.BinaryGisModelWriter writer = new IO.BinaryGisModelWriter();
            writer.Persist(model, modelDataFile);
        }
Exemplo n.º 2
0
 private static SharpEntropy.GisModel Train(SharpEntropy.ITrainingEventReader eventReader, int iterations, int cutoff)
 {
     SharpEntropy.GisTrainer trainer = new SharpEntropy.GisTrainer();
     trainer.TrainModel(iterations, new SharpEntropy.TwoPassDataIndexer(eventReader, cutoff));
     return(new SharpEntropy.GisModel(trainer));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Trains a POS tag maximum entropy model.
 /// </summary>
 /// <param name="eventStream">
 /// Stream of training events
 /// </param>
 /// <param name="iterations">
 /// number of training iterations to perform.
 /// </param>
 /// <param name="cut">
 /// cutoff value to use for the data indexer.
 /// </param>
 /// <returns>
 /// Trained GIS model.
 /// </returns>
 public static SharpEntropy.GisModel Train(SharpEntropy.ITrainingEventReader eventStream, int iterations, int cut)
 {
     SharpEntropy.GisTrainer trainer = new SharpEntropy.GisTrainer();
     trainer.TrainModel(iterations, new SharpEntropy.TwoPassDataIndexer(eventStream, cut));
     return(new SharpEntropy.GisModel(trainer));
 }