Beispiel #1
0
        ParameterSet Mutate(ParameterSet initial)
        {
            ParameterSet   mutated   = initial.Clone();
            ParameterValue parameter = PickParameter(mutated);

            Mutate(parameter);
            return(mutated);
        }
Beispiel #2
0
        public void Run()
        {
            SetTimeouts();
            ParameterSet previous = null;
            ParameterSet trial    = new ParameterSet();

            trial.Add(new ObjectTree(ExtractorBenchmark.Extractor, "Extractor"));
            trial.Add(new ObjectTree(MatcherBenchmark.Matcher, "Matcher"));

            while (true)
            {
                ExtractorBenchmark.Extractor = new Extractor();
                MatcherBenchmark.Matcher     = new ParallelMatcher();
                trial.Rebind(new ObjectTree(ExtractorBenchmark.Extractor, "Extractor"));
                trial.Rebind(new ObjectTree(MatcherBenchmark.Matcher, "Matcher"));
                trial.SaveValues();

                TestReport report = new TestReport();
                report.Configuration.Parameters = trial.Clone();

                bool improved = false;
                try
                {
                    report.Extractor = NicheSlot.GetCachedTemplates(trial);
                    if (report.Extractor == null)
                    {
                        report.Extractor = ExtractorBenchmark.Run();
                    }
                    report.Configuration.DatabaseStatistics.Collect(report.Extractor.Templates);
                    MatcherBenchmark.TestDatabase = report.Extractor.Templates;

                    report.Matcher = MatcherBenchmark.Run();

                    improved = NicheSlot.Fit(report);
                }
                catch (Exception e)
                {
                    if (OnException != null)
                    {
                        OnException(e);
                    }
                }

                if (NicheSlot.BestSolution == null)
                {
                    throw new ApplicationException("Initial parameter set doesn't meet basic NicheSlot criteria");
                }
                if (previous != null)
                {
                    Mutations.Feedback(previous, trial, improved);
                }
                previous = NicheSlot.BestSolution.Configuration.Parameters;
                trial    = Mutations.Mutate(previous);
            }
        }
Beispiel #3
0
        // ------------------------------------------
        // ACCESSORS
        // ------------------------------------------

        #region Accessors

        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>Returns the cloned instance.</returns>
        public override object Clone(params string[] areas)
        {
            var clone = base.Clone(areas) as DbQuery;
            clone.CTETables = CTETables?.Select(p => p.Clone<DbTable>()).ToList();
            clone.Description = Description?.Clone<DictionaryDataItem>();
            clone.Expression = Expression?.Clone<DataExpression>();
            clone.ParameterSet = ParameterSet?.Clone<DataElementSet>();
            clone.ParameterSpecSet = ParameterSpecSet?.Clone<DataElementSpecSet>();
            clone.Title = Title?.Clone<DictionaryDataItem>();

            return clone;
        }
Beispiel #4
0
        public TrainerPipelineNode(CommonInputs.ITrainerInput entryPointObj,
                                   IEnumerable <TlcModule.SweepableParamAttribute> sweepParams = null,
                                   ParameterSet hyperParameterSet = null)
        {
            var newEp = CloneEntryPoint(entryPointObj);

            _entryPointObj = newEp ?? entryPointObj;
            SweepParams    = sweepParams?.Select(p => p.Clone()).ToArray() ??
                             AutoMlUtils.GetSweepRanges(_entryPointObj.GetType());
            HyperSweeperParamSet = hyperParameterSet?.Clone();

            // Make sure sweep params and param set are consistent.
            if (HyperSweeperParamSet != null)
            {
                PropagateParamSetValues(HyperSweeperParamSet, SweepParams);
                UpdateProperties();
            }
        }