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


Python Dataset.setup_pretraining_dataset方法代码示例

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


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

示例1: get_data_patches

# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import setup_pretraining_dataset [as 别名]
def get_data_patches(data):
    ds = Dataset(is_binary=True)
    ds.setup_pretraining_dataset(data_dict[data_key],
    train_split_scale=1.0,
    patch_size=(8, 8))

    ds_test = Dataset(is_binary=True)
    ds_test.setup_pretraining_dataset(data_dict["ds_test"],
    train_split_scale=1.0,
    patch_size=(8, 8))

    XTrain, YTrain = ds.Xtrain_patches, ds.Ytrain
    XTest, YTest = ds_test.Xtrain_patches, ds_test.Ytrain
    return XTrain, YTrain, XTest, YTest
开发者ID:caglar,项目名称:structured_mlp,代码行数:16,代码来源:utils.py

示例2: normalize

# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import setup_pretraining_dataset [as 别名]
    print "Normalizing patch-mlp's outputs"
    pre_train_probs = normalize(pre_train_probs)
    pre_test_train_probs = normalize(pre_test_train_probs)
    pre_test_test_probs = normalize(pre_test_test_probs)

    csvm.train(pre_train_probs, train_set_labels, **post_cs_args["train_args"])

    print "starting post-testing on training dataset"
    train_error = csvm.test(pre_test_train_probs, train_set_labels, **post_cs_args["test_args"])
    print "For training %s" %(train_error)

    print "starting post-testing on the  dataset"
    test_error = csvm.test(pre_test_test_probs, test_set_labels, **post_cs_args["test_args"])
    print "For testing %s" %(test_error)

    import ipdb; ipdb.set_trace()

if __name__=="__main__":
    print "Loading the dataset"
    ds = Dataset()
    patch_size=(16,16)
    ds.setup_pretraining_dataset(data_path="/RQusagers/gulcehre/dataset/pentomino/rnd_pieces/pento64x64_40k_seed_39112222_16patches_rnd.npy", patch_size=patch_size, normalize_inputs=False)
    x = T.matrix('x')
    n_hiddens = [1024, 768]

    prmlp = PatchBasedMLP(x, n_in=16*16, n_hiddens=n_hiddens, n_out=11,
    no_of_patches=16, activation=NeuralActivations.Rectifier, use_adagrad=False)

    csvm = CSVM()
    pre_training(prmlp, csvm, ds)
开发者ID:caglar,项目名称:prmlp,代码行数:32,代码来源:prmlp_postsvm_test_3patches.py

示例3: Dataset

# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import setup_pretraining_dataset [as 别名]
        test_scores.append(numpy.mean(prmlps[i].test_scores))
        if pre_test_probs == None:
            pre_test_probs = prmlps[i].pretrain_test_probs
        else:
            pre_test_probs = numpy.column_stack((pre_test_probs, prmlps[i].pretrain_test_probs))
    print "In the end the test score is %f " % (numpy.mean(test_scores))
    return pre_test_probs

if __name__=="__main__":
    x = T.matrix('x')
    dataset = "/data/lisa/data/pentomino/pentomino64x64_4k_pre.npy"
    ds = Dataset()

    print "starting pretrain"

    ds.setup_pretraining_dataset(data_path=dataset)
    
    train_set_patches, train_set_pre, train_set_labels = ds.Xtrain_patches, ds.Xtrain_presences, ds.Ytrain
    test_set_patches, test_set_pre, test_set_labels = ds.Xtest_patches, ds.Xtest_presences, ds.Ytest

    prmlps = [PreMLP(x) for each in xrange(64)]
    
    print "starting pretest"
    pre_train_probs = train_prmlp(prmlps, train_set_patches, train_set_pre)
    pre_test_probs = test_prmlp(prmlps, test_set_patches, test_set_pre)

    post_mlp = PosttrainMLP(x, n_in=64*11, n_hidden=200, n_out=10)

    post_mlp.posttrain(data=pre_train_probs, labels=train_set_labels, batch_size=80)
    post_mlp.posttest(data=pre_test_probs, labels=test_set_labels)
开发者ID:caglar,项目名称:prmlp,代码行数:32,代码来源:prmlp_test.py


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