示例#1
0
        internal SweepableEstimator[] Regression(string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, bool useFastForest = true, bool useLgbm = true, bool useFastTree = true, bool useLbfgs = true, bool useSdca = true,
                                                 FastTreeOption fastTreeOption = null, LgbmOption lgbmOption = null, FastForestOption fastForestOption = null, LbfgsOption lbfgsOption = null, SdcaOption sdcaOption = null,
                                                 SearchSpace <FastTreeOption> fastTreeSearchSpace = null, SearchSpace <LgbmOption> lgbmSearchSpace = null, SearchSpace <FastForestOption> fastForestSearchSpace = null, SearchSpace <LbfgsOption> lbfgsSearchSpace = null, SearchSpace <SdcaOption> sdcaSearchSpace = null)
        {
            var res = new List <SweepableEstimator>();

            if (useFastTree)
            {
                fastTreeOption = fastTreeOption ?? new FastTreeOption();
                fastTreeOption.LabelColumnName         = labelColumnName;
                fastTreeOption.FeatureColumnName       = featureColumnName;
                fastTreeOption.ExampleWeightColumnName = exampleWeightColumnName;
                res.Add(SweepableEstimatorFactory.CreateFastTreeRegression(fastTreeOption, fastTreeSearchSpace ?? new SearchSpace <FastTreeOption>()));
                res.Add(SweepableEstimatorFactory.CreateFastTreeTweedieRegression(fastTreeOption, fastTreeSearchSpace ?? new SearchSpace <FastTreeOption>()));
            }

            if (useFastForest)
            {
                fastForestOption = fastForestOption ?? new FastForestOption();
                fastForestOption.LabelColumnName         = labelColumnName;
                fastForestOption.FeatureColumnName       = featureColumnName;
                fastForestOption.ExampleWeightColumnName = exampleWeightColumnName;
                res.Add(SweepableEstimatorFactory.CreateFastForestRegression(fastForestOption, fastForestSearchSpace ?? new SearchSpace <FastForestOption>()));
            }

            if (useLgbm)
            {
                lgbmOption = lgbmOption ?? new LgbmOption();
                lgbmOption.LabelColumnName         = labelColumnName;
                lgbmOption.FeatureColumnName       = featureColumnName;
                lgbmOption.ExampleWeightColumnName = exampleWeightColumnName;
                res.Add(SweepableEstimatorFactory.CreateLightGbmRegression(lgbmOption, lgbmSearchSpace ?? new SearchSpace <LgbmOption>()));
            }

            if (useLbfgs)
            {
                lbfgsOption = lbfgsOption ?? new LbfgsOption();
                lbfgsOption.LabelColumnName         = labelColumnName;
                lbfgsOption.FeatureColumnName       = featureColumnName;
                lbfgsOption.ExampleWeightColumnName = exampleWeightColumnName;
                res.Add(SweepableEstimatorFactory.CreateLbfgsPoissonRegressionRegression(lbfgsOption, lbfgsSearchSpace ?? new SearchSpace <LbfgsOption>()));
            }

            if (useSdca)
            {
                sdcaOption = sdcaOption ?? new SdcaOption();
                sdcaOption.LabelColumnName         = labelColumnName;
                sdcaOption.FeatureColumnName       = featureColumnName;
                sdcaOption.ExampleWeightColumnName = exampleWeightColumnName;
                res.Add(SweepableEstimatorFactory.CreateSdcaRegression(sdcaOption, sdcaSearchSpace ?? new SearchSpace <SdcaOption>()));
            }

            return(res.ToArray());
        }