Exemplo n.º 1
0
        public void Search_space_add_option_test()
        {
            var ss = new SearchSpace();

            ss.FeatureSpaceDim.Should().Be(0);

            ss.Add("A", new UniformIntOption(-1000, 1000));
            ss.FeatureSpaceDim.Should().Be(1);

            var param = ss.SampleFromFeatureSpace(new[] { 0.5 });

            param["A"].AsType <int>().Should().Be(0);
        }
Exemplo n.º 2
0
        public void Parameter_AsType_should_be_culture_invariant()
        {
            var originalCuture = Thread.CurrentThread.CurrentCulture;
            var culture        = new CultureInfo("ru", false);

            Thread.CurrentThread.CurrentCulture = culture;
            var ss = new SearchSpace();

            ss.Add("_SampleSize", new UniformDoubleOption(10000, 20000));
            var parameter = ss.SampleFromFeatureSpace(new[] { 0.5 });

            parameter["_SampleSize"].AsType <double>().Should().Be(15000.0);
            Thread.CurrentThread.CurrentCulture = originalCuture;
        }