当前位置: 首页>>代码示例>>Python>>正文


Python config.Config类代码示例

本文整理汇总了Python中osprey.config.Config的典型用法代码示例。如果您正苦于以下问题:Python Config类的具体用法?Python Config怎么用?Python Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_search_engine_moe_2

def test_search_engine_moe_2():
    config = Config.fromdict({
        'strategy': {'name': 'moe', 'params': {'url': 'abc'}}
    }, check_fields=False)
    strat = config.strategy()
    assert isinstance(strat, MOE)
    assert strat.url == 'abc'
开发者ID:Eigenstate,项目名称:osprey,代码行数:7,代码来源:test_config.py

示例2: test_estimator_entry_point

def test_estimator_entry_point():
    config = Config.fromdict({
        'estimator': {
            'entry_point': 'sklearn.cluster.KMeans',
        }
    }, check_fields=False)
    assert isinstance(config.estimator(), KMeans)
开发者ID:Eigenstate,项目名称:osprey,代码行数:7,代码来源:test_config.py

示例3: test_search_space

def test_search_space():
    config = Config.fromdict({
        'search_space': {
            'intvar': {'type': 'int', 'min': 1, 'max': 2},
            'logivar': {'type': 'int', 'min': 1, 'max': 2, 'warp': 'log'},
            'fvar': {'type': 'float', 'min': 1, 'max': 3.5},
            'logfvar': {'type': 'float', 'min': 1, 'max': 2.5, 'warp': 'log'},
            'enumvar': {'type': 'enum', 'choices': [1, False]},
            'jumpivar': {'type': 'jump',  'min': 1, 'max': 3, 'num': 3, 'var_type': int},
            'jumpfvar': {'type': 'jump',  'min': 1, 'max': 3, 'num': 3, 'var_type': float},
            'logjumpivar': {'type': 'jump',  'min': 10, 'max': 1000, 'num': 3, 'warp': 'log', 'var_type': int},
            'logjumpfvar': {'type': 'jump',  'min': 10, 'max': 1000, 'num': 3, 'warp': 'log', 'var_type': float}
        }}, check_fields=False)

    searchspace = config.search_space()
    assert searchspace['intvar'] == IntVariable('intvar', 1, 2, warp=None)
    assert searchspace['logivar'] == IntVariable('logivar', 1, 2, warp='log')
    assert searchspace['fvar'] == FloatVariable('fvar', 1, 3.5, warp=None)
    assert searchspace['logfvar'] == FloatVariable('logfvar', 1, 2.5,
                                                   warp='log')
    assert searchspace['enumvar'] == EnumVariable('enumvar', [1, False])
    assert searchspace['jumpivar'] == EnumVariable('jumpivar', [1, 2, 3])
    assert searchspace['jumpfvar'] == EnumVariable('jumpfvar', [1.0, 2.0, 3.0])
    assert searchspace['logjumpivar'] == EnumVariable('logjumpivar', [10, 100, 1000])
    assert searchspace['logjumpfvar'] == EnumVariable('logjumpfvar', [10.0, 100.0, 1000.0])
开发者ID:msmbuilder,项目名称:osprey,代码行数:25,代码来源:test_config.py

示例4: test_estimator_eval_2

def test_estimator_eval_2():
    config = Config.fromdict({
        'estimator': {
            'eval': 'KMeans()',
            'eval_scope': ['sklearn'],
        }
    }, check_fields=False)
    assert isinstance(config.estimator(), KMeans)
开发者ID:Eigenstate,项目名称:osprey,代码行数:8,代码来源:test_config.py

示例5: test_stratified_cv

def test_stratified_cv():
    from sklearn.cross_validation import StratifiedShuffleSplit
    config = Config.fromdict({
        'cv': {'name': 'stratifiedshufflesplit', 'params': {'n_iter': 10}}
    }, check_fields=False)
    cv = config.cv(range(100), np.random.randint(2, size=100))
    assert isinstance(cv, StratifiedShuffleSplit)
    assert cv.n_iter == 10
开发者ID:Eigenstate,项目名称:osprey,代码行数:8,代码来源:test_config.py

示例6: test_estimator_pickle

def test_estimator_pickle():
    with tempfile.NamedTemporaryFile('w+b', 0) as f:

        cPickle.dump(KMeans(), f)

        config = Config.fromdict({
            'estimator': {'pickle': f.name}
        }, check_fields=False)
        assert isinstance(config.estimator(), KMeans)
开发者ID:Eigenstate,项目名称:osprey,代码行数:9,代码来源:test_config.py

示例7: test_cv_1

def test_cv_1():
    from sklearn.cross_validation import ShuffleSplit
    for name in ['shufflesplit', 'ShuffleSplit']:
        config = Config.fromdict({
            'cv': {'name': name, 'params': {'n_iter': 10}}
        }, check_fields=False)
        cv = config.cv(range(100))
        assert isinstance(cv, ShuffleSplit)
        assert cv.n_iter == 10
开发者ID:kyleabeauchamp,项目名称:osprey,代码行数:9,代码来源:test_config.py

示例8: test_estimator_entry_point_params

def test_estimator_entry_point_params():
    config = Config.fromdict({
        'estimator': {
            'entry_point': 'sklearn.cluster.KMeans',
            'params': {
                'n_clusters': 15
            }
        }
    }, check_fields=False)
    assert isinstance(config.estimator(), KMeans)
    assert config.estimator().n_clusters == 15
开发者ID:Eigenstate,项目名称:osprey,代码行数:11,代码来源:test_config.py

示例9: test_search_space

def test_search_space():
    config = Config.fromdict({
        'search_space': {
            'intvar': {'type': 'int', 'min': 1, 'max': 2},
            'fvar': {'type': 'float', 'min': 1, 'max': 3.5},
            'logvar': {'type': 'float', 'min': 1, 'max': 2.5, 'warp': 'log'},
            'enumvar': {'type': 'enum', 'choices': [1, False]},
        }}, check_fields=False)
    searchspace = config.search_space()
    assert searchspace['intvar'] == IntVariable('intvar', 1, 2)
    assert searchspace['fvar'] == FloatVariable('fvar', 1, 3.5, warp=None)
    assert searchspace['logvar'] == FloatVariable('logvar', 1, 2.5, warp='log')
    assert searchspace['enumvar'] == EnumVariable('enumvar', [1, False])
开发者ID:Eigenstate,项目名称:osprey,代码行数:13,代码来源:test_config.py

示例10: test_trial_results

def test_trial_results():
    assert OSPREY_BIN is not None
    cwd = os.path.abspath(os.curdir)
    dirname = tempfile.mkdtemp()

    try:
        os.chdir(dirname)
        subprocess.check_call([OSPREY_BIN, 'skeleton', '-t', 'random_example',
                              '-f', 'config.yaml'])
        subprocess.check_call([OSPREY_BIN, 'worker', 'config.yaml', '-n', '5'])
        assert os.path.exists('osprey-trials.db')

        config = Config('config.yaml')

        df = config.trial_results()

        assert df.shape[0] == 5

        for key in Trial.__table__.columns.keys():
            assert key in df.columns

    finally:
        os.chdir(cwd)
        shutil.rmtree(dirname)
开发者ID:msmbuilder,项目名称:osprey,代码行数:24,代码来源:test_config.py

示例11: test_search_engine_moe_1

def test_search_engine_moe_1():
    config = Config.fromdict({
        'strategy': {'name': 'moe', 'params': {'url': 'sdfsdf'}}
    }, check_fields=False)
    assert isinstance(config.strategy(), MOE)
开发者ID:Eigenstate,项目名称:osprey,代码行数:5,代码来源:test_config.py

示例12: test_search_engine_hyperopt_tpe

def test_search_engine_hyperopt_tpe():
    config = Config.fromdict({
        'strategy': {'name': 'hyperopt_tpe'}
    }, check_fields=False)
    assert isinstance(config.strategy(), HyperoptTPE)
开发者ID:Eigenstate,项目名称:osprey,代码行数:5,代码来源:test_config.py

示例13: test_strategy_random

def test_strategy_random():
    config = Config.fromdict({
        'strategy': {'name': 'random'}
    }, check_fields=False)
    assert isinstance(config.strategy(), RandomSearch)
开发者ID:Eigenstate,项目名称:osprey,代码行数:5,代码来源:test_config.py

示例14: test_scoring

def test_scoring():
    config = Config.fromdict({
        'scoring': 'sdfsfsdf'
    }, check_fields=False)
    assert config.scoring() is 'sdfsfsdf'
开发者ID:Eigenstate,项目名称:osprey,代码行数:5,代码来源:test_config.py

示例15: test_random_seed

def test_random_seed():
    config = Config.fromdict({
        'random_seed': 42
    }, check_fields=False)
    assert config.random_seed() == 42
开发者ID:msmbuilder,项目名称:osprey,代码行数:5,代码来源:test_config.py


注:本文中的osprey.config.Config类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。