Exemple #1
0
        public static CommonOutputs.AnomalyDetectionOutput CreateAnomalyPipelineEnsemble(IHostEnvironment env, PipelineAnomalyInput input)
        {
            Contracts.CheckValue(env, nameof(env));
            var host = env.Register("CombineModels");

            host.CheckValue(input, nameof(input));
            host.CheckNonEmpty(input.Models, nameof(input.Models));

            IRegressionOutputCombiner combiner;

            switch (input.ModelCombiner)
            {
            case ScoreCombiner.Median:
                combiner = new Median(host);
                break;

            case ScoreCombiner.Average:
                combiner = new Average(host);
                break;

            default:
                throw host.Except("Unknown combiner kind");
            }
            var ensemble = SchemaBindablePipelineEnsembleBase.Create(host, input.Models, combiner, AnnotationUtils.Const.ScoreColumnKind.AnomalyDetection);

            return(CreatePipelineEnsemble <CommonOutputs.AnomalyDetectionOutput>(host, input.Models, ensemble));
        }
Exemple #2
0
        public static CommonOutputs.BinaryClassificationOutput CreateBinaryPipelineEnsemble(IHostEnvironment env, PipelineClassifierInput input)
        {
            Contracts.CheckValue(env, nameof(env));
            var host = env.Register("CombineModels");

            host.CheckValue(input, nameof(input));
            host.CheckNonEmpty(input.Models, nameof(input.Models));

            IBinaryOutputCombiner combiner;

            switch (input.ModelCombiner)
            {
            case ClassifierCombiner.Median:
                combiner = new Median(host);
                break;

            case ClassifierCombiner.Average:
                combiner = new Average(host);
                break;

            case ClassifierCombiner.Vote:
                combiner = new Voting(host);
                break;

            default:
                throw host.Except("Unknown combiner kind");
            }
            var ensemble = SchemaBindablePipelineEnsembleBase.Create(host, input.Models, combiner, MetadataUtils.Const.ScoreColumnKind.BinaryClassification);

            return(CreatePipelineEnsemble <CommonOutputs.BinaryClassificationOutput>(host, input.Models, ensemble));
        }