Пример #1
0
        /// <summary>
        /// Train a model using the GIS algorithm.
        /// </summary>
        /// <param name="iterations">
        ///          The number of GIS iterations to perform. </param>
        /// <param name="indexer">
        ///          The object which will be used for event compilation. </param>
        /// <param name="printMessagesWhileTraining">
        ///          Determines whether training status messages are written to STDOUT. </param>
        /// <param name="smoothing">
        ///          Defines whether the created trainer will use smoothing while
        ///          training the model. </param>
        /// <param name="modelPrior">
        ///          The prior distribution for the model. </param>
        /// <param name="cutoff">
        ///          The number of times a predicate must occur to be used in a model. </param>
        /// <returns> The newly trained model, which can be used immediately or saved to
        ///         disk using an opennlp.maxent.io.GISModelWriter object. </returns>
        public static GISModel trainModel(int iterations, DataIndexer indexer, bool printMessagesWhileTraining,
                                          bool smoothing, Prior modelPrior, int cutoff, int threads)
        {
            GISTrainer trainer = new GISTrainer(printMessagesWhileTraining);

            trainer.Smoothing            = smoothing;
            trainer.SmoothingObservation = SMOOTHING_OBSERVATION;
            if (modelPrior == null)
            {
                modelPrior = new UniformPrior();
            }

            return(trainer.trainModel(iterations, indexer, modelPrior, cutoff, threads));
        }
Пример #2
0
 /// <summary>
 /// Train a model using the GIS algorithm.
 /// </summary>
 /// <param name="iterations">
 ///          The number of GIS iterations to perform. </param>
 /// <param name="indexer">
 ///          The object which will be used for event compilation. </param>
 /// <param name="printMessagesWhileTraining">
 ///          Determines whether training status messages are written to STDOUT. </param>
 /// <param name="smoothing">
 ///          Defines whether the created trainer will use smoothing while
 ///          training the model. </param>
 /// <param name="modelPrior">
 ///          The prior distribution for the model. </param>
 /// <param name="cutoff">
 ///          The number of times a predicate must occur to be used in a model. </param>
 /// <returns> The newly trained model, which can be used immediately or saved to
 ///         disk using an opennlp.maxent.io.GISModelWriter object. </returns>
 public static GISModel trainModel(int iterations, DataIndexer indexer, bool printMessagesWhileTraining,
                                   bool smoothing, Prior modelPrior, int cutoff)
 {
     return(trainModel(iterations, indexer, printMessagesWhileTraining, smoothing, modelPrior, cutoff, 1));
 }
Пример #3
0
 /// <summary>
 /// Train a model using the GIS algorithm.
 /// </summary>
 /// <param name="iterations">
 ///          The number of GIS iterations to perform. </param>
 /// <param name="indexer">
 ///          The object which will be used for event compilation. </param>
 /// <returns> The newly trained model, which can be used immediately or saved to
 ///         disk using an opennlp.maxent.io.GISModelWriter object. </returns>
 public static GISModel trainModel(int iterations, DataIndexer indexer)
 {
     return(trainModel(iterations, indexer, true, false, null, 0));
 }
Пример #4
0
 /// <summary>
 /// Train a model using the GIS algorithm with the specified number of
 /// iterations, data indexer, and prior.
 /// </summary>
 /// <param name="iterations">
 ///          The number of GIS iterations to perform. </param>
 /// <param name="indexer">
 ///          The object which will be used for event compilation. </param>
 /// <param name="modelPrior">
 ///          The prior distribution for the model. </param>
 /// <returns> The newly trained model, which can be used immediately or saved to
 ///         disk using an opennlp.maxent.io.GISModelWriter object. </returns>
 public static GISModel trainModel(int iterations, DataIndexer indexer, Prior modelPrior, int cutoff)
 {
     return(trainModel(iterations, indexer, true, false, modelPrior, cutoff));
 }
Пример #5
0
 /// <summary>
 /// Train a model using the GIS algorithm.
 /// </summary>
 /// <param name="iterations">
 ///          The number of GIS iterations to perform. </param>
 /// <param name="indexer">
 ///          The object which will be used for event compilation. </param>
 /// <param name="smoothing">
 ///          Defines whether the created trainer will use smoothing while
 ///          training the model. </param>
 /// <returns> The newly trained model, which can be used immediately or saved to
 ///         disk using an opennlp.maxent.io.GISModelWriter object. </returns>
 public static GISModel trainModel(int iterations, DataIndexer indexer, bool smoothing)
 {
     return(trainModel(iterations, indexer, true, smoothing, null, 0));
 }