Example #1
0
        private void Train(ExperimentModifier settings)
        {
            var setup = MulticlassExperimentSettingsHelper.SetupExperiment(_mLContext, settings, settings.Paths, settings.ForPrs);

            try
            {
                // Start experiment
                var textLoader = _mLContext.Data.CreateTextLoader(setup.columnInference.TextLoaderOptions);
                var paths      = settings.Paths;

                // train once:
                var experimentResult = MulticlassExperimentHelper.Train(
                    _mLContext, settings.LabelColumnName, setup.experimentSettings, new MulticlassExperimentProgressHandler(), paths, textLoader);

                // train twice
                var refitModel = MulticlassExperimentHelper.Retrain(experimentResult,
                                                                    "refit model",
                                                                    new MultiFileSource(paths.TrainPath, paths.ValidatePath),
                                                                    paths.ValidatePath,
                                                                    paths.FittedModelPath, textLoader, _mLContext);

                // final train:
                refitModel = MulticlassExperimentHelper.Retrain(_mLContext, experimentResult, setup.columnInference, paths);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
        }
Example #2
0
 public void Test(DataFilePaths files, bool forPrs)
 {
     MulticlassExperimentHelper.TestPrediction(_mLContext, files, forPrs: forPrs);
 }