コード例 #1
0
        private static (Parameters, TpeParameters) Suggest(SearchSpace space, List <Result> history)
        {
            Parameters    formattedParam = new Parameters();
            TpeParameters param          = new TpeParameters();

            int pipelineIndex  = SuggestCategorical(history, "__pipeline__", space.pipelines.Count);
            var chosenPipeline = space.pipelines[pipelineIndex];

            foreach (AlgorithmSpace algo in space.algorithms.Values)
            {
                if (chosenPipeline.Contains(algo.name))
                {
                    var formattedAlgo = new AlgorithmParameters();
                    formattedParam[algo.name] = formattedAlgo;

                    foreach (ParameterRange range in algo)
                    {
                        if (range.isCategorical)
                        {
                            int index = SuggestCategorical(history, range.tag, range.size);
                            param[range.tag]          = index;
                            formattedAlgo[range.name] = range.categoricalValues[index];
                        }
                        else
                        {
                            double x = SuggestNumerical(history, range.tag, range.low, range.high, range.isLogDistributed, range.isInteger);
                            param[range.tag]          = x;
                            formattedAlgo[range.name] = range.isInteger ? ((int)x).ToString() : x.ToString();
                        }
                    }
                }
            }

            return(formattedParam, param);
        }
コード例 #2
0
 public Result(int id, double loss, TpeParameters param)
 {
     this.id    = id;
     this.loss  = loss;
     this.param = param;
 }