예제 #1
0
def test_save_restore(tmpdir):
    space = FeatureSpace({
        'a': Feature(DiscreteBox([0, 12])),
        'b': Feature(Box((0, 1)), lengthDomain=DiscreteBox((1, 2)))
    })
    sampler = FeatureSampler.simulatedAnnealingSamplerFor(space, sa_params)

    checkSaveRestore(sampler, tmpdir, iterations=10)
예제 #2
0
def test_save_restore(tmpdir):
    space = FeatureSpace({
        'a': Feature(DiscreteBox([0, 12])),
        'b': Feature(Box((0, 1)), lengthDomain=DiscreteBox((1, 2)))
    })
    halton_params = DotMap(sample_index=0, bases_skipped=0)
    sampler = FeatureSampler.haltonSamplerFor(space, halton_params)

    checkSaveRestore(sampler, tmpdir)
예제 #3
0
def test_save_restore(tmpdir):
    space = FeatureSpace({
        'a': Feature(DiscreteBox([0, 12])),
        'b': Feature(Box((0, 1)), lengthDomain=DiscreteBox((1, 2)))
    })
    bo_params = DotMap(init_num=2)
    sampler = FeatureSampler.bayesianOptimizationSamplerFor(space, bo_params)

    checkSaveRestore(sampler, tmpdir)
예제 #4
0
def test_save_restore(tmpdir):
    space = FeatureSpace({
        'a':
        Feature(DiscreteBox([0, 12])),
        'b':
        Feature(Box((0, 1))),
        'c':
        Feature(Box((0, 1), (-1, 1)), lengthDomain=DiscreteBox((0, 1)))
    })
    ce_params = DotMap(alpha=0.9, thres=0)
    ce_params.cont.buckets = 5
    ce_params.cont.dist = None
    ce_params.disc.dist = None
    sampler = FeatureSampler.crossEntropySamplerFor(space, ce_params)

    checkSaveRestore(sampler, tmpdir, iterations=30)
예제 #5
0
def test_active_save_restore(tmpdir):
    sampler = ScenicSampler.fromScenicCode(
        'param verifaiSamplerType = "halton"\n'
        'ego = Object at VerifaiRange(-1, 1) @ 0',
        maxIterations=1)
    checkSaveRestore(sampler, tmpdir)
예제 #6
0
def test_save_restore(tmpdir):
    sampler = ScenicSampler.fromScenicCode('ego = Object at Range(-1, 1) @ 0',
                                           maxIterations=1)
    checkSaveRestore(sampler, tmpdir)