示例#1
0
        public static MultiModelPipeline Append(this MultiModelPipeline pipeline, IEstimator <ITransformer> estimator)
        {
            var sweepableEstimator = new SweepableEstimator((context, parameter) => estimator, new SearchSpace.SearchSpace());
            var multiModelPipeline = pipeline.Append(sweepableEstimator);

            return(multiModelPipeline);
        }
示例#2
0
        public static MultiModelPipeline Append(this SweepableEstimator estimator, params SweepableEstimator[] estimators)
        {
            var multiModelPipeline = new MultiModelPipeline();

            multiModelPipeline = multiModelPipeline.Append(estimator);

            return(multiModelPipeline.Append(estimators));
        }
示例#3
0
        public static MultiModelPipeline Append(this SweepableEstimatorPipeline pipeline, params SweepableEstimator[] estimators)
        {
            var multiModelPipeline = new MultiModelPipeline();

            foreach (var estimator in pipeline.Estimators)
            {
                multiModelPipeline = multiModelPipeline.Append(estimator);
            }

            return(multiModelPipeline.Append(estimators));
        }
        public void MultiModelPipeline_append_test()
        {
            var e1 = new SweepableEstimator(CodeGen.EstimatorType.Concatenate);
            var e2 = new SweepableEstimator(CodeGen.EstimatorType.ConvertType);
            var e3 = new SweepableEstimator(CodeGen.EstimatorType.ApplyOnnxModel);
            var e4 = new SweepableEstimator(CodeGen.EstimatorType.LightGbmBinary);

            var pipeline = new MultiModelPipeline();

            pipeline = pipeline.Append(e1, e2).AppendOrSkip(e3, e4);
            pipeline.Schema.ToString().Should().Be("(e0 + e1) * (e2 + e3 + Nil)");
            pipeline.BuildSweepableEstimatorPipeline("e0 * e2").ToString().Should().Be("Concatenate=>ApplyOnnxModel");
            pipeline.BuildSweepableEstimatorPipeline("e1 * Nil").ToString().Should().Be("ConvertType");
        }
示例#5
0
        private MultiModelPipeline CreateMultiModelPipeline()
        {
            var concat = SweepableEstimatorFactory.CreateConcatenate(new ConcatOption());
            var replaceMissingValue = SweepableEstimatorFactory.CreateReplaceMissingValues(new ReplaceMissingValueOption());
            var oneHot   = SweepableEstimatorFactory.CreateOneHotEncoding(new OneHotOption());
            var lightGbm = SweepableEstimatorFactory.CreateLightGbmBinary(new LgbmOption());
            var fastTree = SweepableEstimatorFactory.CreateFastTreeBinary(new FastTreeOption());

            var pipeline = new MultiModelPipeline();

            pipeline = pipeline.AppendOrSkip(replaceMissingValue + replaceMissingValue * oneHot);
            pipeline = pipeline.AppendOrSkip(concat);
            pipeline = pipeline.Append(lightGbm + fastTree);

            return(pipeline);
        }
示例#6
0
        public void MultiModelPipeline_append_pipeline_test()
        {
            var e1 = new SweepableEstimator(CodeGen.EstimatorType.Concatenate);
            var e2 = new SweepableEstimator(CodeGen.EstimatorType.ConvertType);
            var e3 = new SweepableEstimator(CodeGen.EstimatorType.ApplyOnnxModel);
            var e4 = new SweepableEstimator(CodeGen.EstimatorType.LightGbmBinary);
            var e5 = new SweepableEstimator(CodeGen.EstimatorType.FastTreeBinary);

            var pipeline1 = new MultiModelPipeline();
            var pipeline2 = new MultiModelPipeline();

            pipeline1 = pipeline1.Append(e1 + e2 * e3);
            pipeline2 = pipeline2.Append(e1 * (e3 + e4) + e5);

            pipeline1 = pipeline1.Append(pipeline2);

            pipeline1.Schema.ToString().Should().Be("(e0 + e1 * e2) * (e3 * (e4 + e5) + e6)");
        }