public void TestMaxentOnPrepAttachData2Threads() { var trainer = new GISTrainer(); var di = new TwoPassDataIndexer(PrepAttachDataUtility.CreateTrainingStream(), 1); var model = trainer.TrainModel(100, di, new UniformPrior(), 1, 2); PrepAttachDataUtility.TestModel(model, 0.7997028967566229d); }
/// <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)); }
public void TestMaxentOnPrepAttachData() { var model = new GISTrainer().TrainModel(100, new TwoPassDataIndexer(PrepAttachDataUtility.CreateTrainingStream(), 1), 1); PrepAttachDataUtility.TestModel(model, 0.7997028967566229d); }
/// <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); }