public void Nest_search_space_mapping_to_feature_space_test() { var ss = new SearchSpace <NestSearchSpace>(); var param = ss.SampleFromFeatureSpace(new[] { 0.0, 0, 0, 0, 0, 0, 0, 0 }); var features = ss.MappingToFeatureSpace(param); features.Should().Equal(0, 0, 0, 0, 0, 0, 0, 0); param = ss.SampleFromFeatureSpace(new[] { 0.5, 0.5, 0, 0.5, 0.5, 0.5, 0.5, 0.5 }); features = ss.MappingToFeatureSpace(param); features.Should().Equal(0.5, 0.5, 0, 0.5, 0.5, 0.5, 0.5, 0.5); }
public void Search_space_default_search_space_test() { var defaultSearchSpace = new DefaultSearchSpace() { String = "String", Int = 10, Bool = true, JTokenType = JsonTokenType.Null, }; var ss = new SearchSpace <DefaultSearchSpace>(defaultSearchSpace); var param = ss.SampleFromFeatureSpace(new double[0]); param.Int.Should().Be(10); param.Float.Should().Be(0f); param.Double.Should().Be(0); param.Bool.Should().BeTrue(); param.String.Should().Be("String"); param.Strings.Should().BeEquivalentTo("A", "B", "C"); param.JTokenType.Should().Be(JsonTokenType.Null); param.NullString.Should().BeNull(); ss.FeatureSpaceDim.Should().Be(0); ss.MappingToFeatureSpace(param).Should().HaveCount(0); }