// This method will be called for each input received from the pipeline to this cmdlet; if no input is received, this method is not called protected override void ProcessRecord() { var context = new MLContext(); var columnInferenceResults = InferColumnsHelper.InferColumns(context, this.Path, new ColumnInformation() { LabelColumnName = this.Label }, null, null, null, false, false, true); var textLoader = context.Data.CreateTextLoader(columnInferenceResults.TextLoaderOptions, null); var trainDataset = textLoader.Load(new MultiFileSource(this.Path)); IProgress <RunDetail <MulticlassClassificationMetrics> > progressHandler = new ProgressToCallback <RunDetail <MulticlassClassificationMetrics> >((metric) => { WriteObject(metric); }); var results = context.Auto() .CreateMulticlassClassificationExperiment(10) .Execute(trainDataset, columnInferenceResults.ColumnInformation, null, progressHandler); }
// This method will be called for each input received from the pipeline to this cmdlet; if no input is received, this method is not called protected override void ProcessRecord() { var context = new MLContext(); var columnInferenceResults = InferColumnsHelper.InferColumns(context, this.Path, new ColumnInformation() { LabelColumnName = this.Label, UserIdColumnName = this.User, ItemIdColumnName = this.Item }, null, null, null, false, false, true); var textLoader = context.Data.CreateTextLoader(columnInferenceResults.TextLoaderOptions, null); var trainDataset = textLoader.Load(new MultiFileSource(this.Path)); IProgress <RunDetail <RegressionMetrics> > progressHandler = new ProgressToCallback <RunDetail <RegressionMetrics> >((metric) => { WriteObject(metric); }); var results = context.Auto() .CreateRecommendationExperiment(10) .Execute(trainDataset, columnInferenceResults.ColumnInformation, null, progressHandler); WriteVerbose("Best Trainer :" + results.BestRun.TrainerName); WriteObject(results); }