Esempio n. 1
0
File: GIS.cs Progetto: qooba/SharpNL
        /// <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>
        /// <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>
        /// <param name="threads">The number of threads to use during the training.</param>
        /// <param name="monitor">
        /// A evaluation monitor that can be used to listen the messages during the training or it can cancel the training operation.
        /// This argument can be a <c>null</c> value.
        /// </param>
        /// <returns>The newly trained model, which can be used immediately or saved to disk using a <see cref="GISModelWriter"/> object.</returns>
        public static GISModel TrainModel(int iterations, IDataIndexer indexer, bool smoothing, IPrior modelPrior, int cutoff, int threads, Monitor monitor)
        {
            var trainer = new GISTrainer(monitor)
            {
                Smoothing            = smoothing,
                SmoothingObservation = SmoothingObservation
            };

            if (modelPrior == null)
            {
                modelPrior = new UniformPrior();
            }

            return(trainer.TrainModel(iterations, indexer, modelPrior, cutoff, threads));
        }
Esempio n. 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="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>
        /// <param name="threads">The number of threads to use during the training.</param>
        /// <param name="monitor">
        /// A evaluation monitor that can be used to listen the messages during the training or it can cancel the training operation.
        /// This argument can be a <c>null</c> value.
        /// </param>
        /// <returns>The newly trained model, which can be used immediately or saved to disk using a <see cref="GISModelWriter"/> object.</returns>
        public static GISModel TrainModel(int iterations, IDataIndexer indexer, bool smoothing, IPrior modelPrior, int cutoff, int threads, Monitor monitor) {
                var trainer = new GISTrainer(monitor) {
                Smoothing = smoothing,
                SmoothingObservation = SmoothingObservation
            };

            if (modelPrior == null) {
                modelPrior = new UniformPrior();
            }

            return trainer.TrainModel(iterations, indexer, modelPrior, cutoff, threads);
        }