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


Python SON.copy方法代码示例

本文整理汇总了Python中bson.SON.copy方法的典型用法代码示例。如果您正苦于以下问题:Python SON.copy方法的具体用法?Python SON.copy怎么用?Python SON.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bson.SON的用法示例。


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

示例1: train_test_loop

# 需要导入模块: from bson import SON [as 别名]
# 或者: from bson.SON import copy [as 别名]
def train_test_loop(outfile,extract_creates,task_config,feature_config_path,hash):

    feature_config = get_config(feature_config_path)
        
    base_query = SON([('__config_hash__',hash)])
    
    image_params = SON([('image',feature_config['image'])])
    models_params = feature_config['models']

    ntrain = task_config['ntrain']
    ntest = task_config['ntest']
    ntrain_pos = task_config.get('ntrain_pos')
    N = task_config.get('N',10)
    query = task_config['query']  
    base_query.update(reach_in('config',task_config.get('universe',SON([]))))
 
    print('\n')
    print('BASE',base_query)
    print('\n')
    
    conn = pm.Connection(document_class=SON)
    db = conn['v1']
    fs = gridfs.GridFS(db, collection = 'model_performance')
    
    cquery = reach_in('config',query)
    for m in models_params:
        base_query_copy = base_query.copy()
        base_query_copy.update(reach_in('config.model',m))
        splitdata, results = train_test(cquery,'v1','features',ntrain,ntest,ntrain_pos=ntrain_pos,N=N,universe=base_query_copy)
        
        splitpickle = cPickle.dumps(splitdata)
        
        data = SON([('feature_config_path',feature_config_path),
                    ('model',m),
                    ('task',son_escape(task_config)),
                    ('image__aggregate__',son_escape(feature_config['image']))])
        filename = get_filename(data)
        data.update(results)
        data['filename'] = filename
        

        fs.put(splitpickle,**data)
        
    createCertificateDict(outfile,{'task_config':task_config,'feature_config':feature_config,'feature_config_path':feature_config_path})    
开发者ID:yamins81,项目名称:v1framework,代码行数:46,代码来源:main.py

示例2: write_outcerts

# 需要导入模块: from bson import SON [as 别名]
# 或者: from bson.SON import copy [as 别名]
def write_outcerts(func, configs, incertdicts, outcertpaths, db):
    if incertdicts:
        old_param_names = dict_union([op["param_names"] for op in incertdicts])
    else:
        old_param_names = SON([])

    new_param_names = uniqify(ListUnion([x.keys() for x in configs]))
    for (outcertpath, outroot) in zip(outcertpaths, func.outroots):
        param_names = old_param_names.copy()
        param_names[outroot] = new_param_names
        remove_incorrect(db, outroot, func.outconfig_string, func.outrun_hash)
        createCertificateDict(
            outcertpath,
            {
                "run_hash": func.outrun_hash,
                "db": func.dbname,
                "out_args": func.out_args,
                "root": outroot,
                "config_hash": func.outconfig_string,
                "param_names": param_names,
            },
        )
开发者ID:yamins81,项目名称:v1framework,代码行数:24,代码来源:dbutils.py

示例3: SON

# 需要导入模块: from bson import SON [as 别名]
# 或者: from bson.SON import copy [as 别名]
# - output local normalization
('normout', SON([
    # kernel shape of the local normalization
    ('kshape', (3,3)),
    # magnitude threshold
    # if the vector's length is below, it doesn't get resized
    ('threshold', 1.0),
    ])),


])

models = []
for ac in sp.arange(.25,.3,.01):
    m = base_model.copy()
    m['activ'] = m['activ'].copy()
    m['activ']['minout'] = ac
    models.append(m)

# dict with all representation parameters
config = {

'models': models,

'image' : SON([
      ('generator' , 'cairo'),
      ('width' , 64),
      ('height' , 64),
      ('objects' , [cairo_objects.SQUARE]),
      ('patterns' , [cairo_objects.SOLID_RED]),
开发者ID:yamins81,项目名称:v1framework,代码行数:32,代码来源:config_pull_cairofilters_sq_vs_rect_various_activations_finefinetuning.py

示例4: or

# 需要导入模块: from bson import SON [as 别名]
# 或者: from bson.SON import copy [as 别名]
    # Include color histograms ? None or nbins per color
    ('input_colorhists' , None),
    # Include input norm histograms ? None or (division, nfeatures)    
    ('normin_hists' , None),
    # Include filter output histograms ? None or (division, nfeatures)
    ('filter_hists' , None),
    # Include activation output histograms ? None or (division, nfeatures)    
    ('activ_hists' , None),
    # Include output norm histograms ? None or (division, nfeatures)
    ('normout_hists' , None),
    # Include representation output histograms ? None or (division, nfeatures)
    ('pool_hists' , None),
    ]))
])

model2 = model1.copy()
model2['filter'] = SON([
    ('model_name','random_gabor'),
    ('kshape' , [43,43]),
    ('max_wavelength',18),
    ('min_wavelength',2),
    ('num_filters',96),
    ])

model3 = model1.copy()
model3['filter'] = SON([
    ('model_name','really_random'),
    ('kshape' , [43,43]),
    ('num_filters' , 96),
    ])
开发者ID:yamins81,项目名称:v1framework,代码行数:32,代码来源:config_experiment1.py

示例5: SON

# 需要导入模块: from bson import SON [as 别名]
# 或者: from bson.SON import copy [as 别名]
    ])),

# - output local normalization
('normout', SON([
    # kernel shape of the local normalization
    ('kshape', (3,3)),
    # magnitude threshold
    # if the vector's length is below, it doesn't get resized
    ('threshold', 1.0),
    ])),


])
# dict with all representation parameters

models = [model.copy() for ind in range(10)]
for (i,m) in enumerate(models):
    m['ind'] = i
    
config = {

'models': models,

'image' : SON([
      ('generator' , 'cairo'),
      ('width' , 64),
      ('height' , 64),
      ('objects' , [cairo_objects.SQUARE]),
      ('patterns' , [cairo_objects.SOLID_RED]),
      ('tx' , SON([('$gt' , -.4) , ('$lt' , .401) , ('delta' , .02)])),
      ('ty' , SON([('$gt' , -.4) , ('$lt' , .401) , ('delta' , .02)])),
开发者ID:yamins81,项目名称:v1framework,代码行数:33,代码来源:config_pull_random_gabors_sq_vs_rect_twofilter_screen.py

示例6: SON

# 需要导入模块: from bson import SON [as 别名]
# 或者: from bson.SON import copy [as 别名]
# - output local normalization
('normout', SON([
    # kernel shape of the local normalization
    ('kshape', (3,3)),
    # magnitude threshold
    # if the vector's length is below, it doesn't get resized
    ('threshold', 1.0),
    ])),


])

models = []
for divfreq in [2,6,10]:
    for kshape in [[20,20],[32,32],[43,43]]:
        m = model.copy()
        m['filter'] = model['filter'].copy()
        m['filter']['kshape'] = kshape
        m['filter']['divfreqs'] = [divfreq]
        models.append(m)

# dict with all representation parameters
config = {

'models': models,

'image' : SON([
      ('generator' , 'cairo'),
      ('width' , 64),
      ('height' , 64),
      ('objects' , [cairo_objects.SQUARE]),
开发者ID:yamins81,项目名称:v1framework,代码行数:33,代码来源:config_pull_gridded_gabors_sq_vs_rect_various_two_orientation_lrl.py


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