private (Pipeline, ColumnInferenceResults) GetMockedOvaPipelineAndInference() { if (_mockedOvaPipeline == null) { MLContext context = new MLContext(); // same learners with different hyperparameters var hyperparams1 = new Microsoft.ML.AutoML.ParameterSet(new List <Microsoft.ML.AutoML.IParameterValue>() { new LongParameterValue("NumLeaves", 2) }); var trainer1 = new SuggestedTrainer(context, new FastForestOvaExtension(), new ColumnInformation(), hyperparams1); var transforms1 = new List <SuggestedTransform>() { ColumnConcatenatingExtension.CreateSuggestedTransform(context, new[] { "In" }, "Out") }; var inferredPipeline1 = new SuggestedPipeline(transforms1, new List <SuggestedTransform>(), trainer1, context, true); this._mockedOvaPipeline = inferredPipeline1.ToPipeline(); var textLoaderArgs = new TextLoader.Options() { Columns = new[] { new TextLoader.Column("Label", DataKind.Boolean, 0), new TextLoader.Column("col1", DataKind.Single, 1), new TextLoader.Column("col2", DataKind.Single, 0), new TextLoader.Column("col3", DataKind.String, 0), new TextLoader.Column("col4", DataKind.Int32, 0), new TextLoader.Column("col5", DataKind.UInt32, 0), }, AllowQuoting = true, AllowSparse = true, HasHeader = true, Separators = new[] { ',' } }; this._columnInference = new ColumnInferenceResults() { TextLoaderOptions = textLoaderArgs, ColumnInformation = new ColumnInformation() { LabelColumnName = "Label" } }; } return(_mockedOvaPipeline, _columnInference); }
private (Pipeline, ColumnInferenceResults) GetMockedRecommendationPipelineAndInference() { if (mockedPipeline == null) { MLContext context = new MLContext(); var trainer1 = new SuggestedTrainer(context, new MatrixFactorizationExtension(), new ColumnInformation() { LabelColumnName = "Label", UserIdColumnName = "userId", ItemIdColumnName = "movieId", }, hyperParamSet: null); var transforms1 = new List <SuggestedTransform>() { ColumnConcatenatingExtension.CreateSuggestedTransform(context, new[] { "In" }, "Out") }; var inferredPipeline1 = new SuggestedPipeline(transforms1, new List <SuggestedTransform>(), trainer1, context, false); mockedPipeline = inferredPipeline1.ToPipeline(); var textLoaderArgs = new TextLoader.Options() { Columns = new[] { new TextLoader.Column("Label", DataKind.String, 0), new TextLoader.Column("userId", DataKind.String, 1), new TextLoader.Column("movieId", DataKind.String, 2), }, AllowQuoting = true, AllowSparse = true, HasHeader = true, Separators = new[] { ',' } }; this.columnInference = new ColumnInferenceResults() { TextLoaderOptions = textLoaderArgs, ColumnInformation = new ColumnInformation() { LabelColumnName = "Label", UserIdColumnName = "userId", ItemIdColumnName = "movieId" } }; } return(mockedPipeline, columnInference); }