• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python skip.skip_if_no_data函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_one_hot

def test_one_hot():
    skip_if_no_data()
    data = icml07.MNIST_rotated_background(which_set='train', one_hot=True, split=(100,100,100))
    assert data.y.shape[1] == 10   # MNITS hast 10 classes

    data = icml07.Rectangles(which_set='train', one_hot=True, split=(100,100,100))
    assert data.y.shape[1] == 2   # Two classes
开发者ID:BloodD,项目名称:pylearn2,代码行数:7,代码来源:test_icml07.py


示例2: test_convolutional_network

def test_convolutional_network():
    """Test smaller version of convolutional_network.ipynb"""
    skip.skip_if_no_data()
    yaml_file_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                                  '..'))
    save_path = os.path.dirname(os.path.realpath(__file__))
    # Escape potential backslashes in Windows filenames, since
    # they will be processed when the YAML parser will read it
    # as a string
    save_path.replace('\\', r'\\')

    yaml = open("{0}/conv.yaml".format(yaml_file_path), 'r').read()
    hyper_params = {'train_stop': 50,
                    'valid_stop': 50050,
                    'test_stop': 50,
                    'batch_size': 50,
                    'output_channels_h2': 4,
                    'output_channels_h3': 4,
                    'max_epochs': 1,
                    'save_path': save_path}
    yaml = yaml % (hyper_params)
    train = yaml_parse.load(yaml)
    train.main_loop()

    try:
        os.remove("{}/convolutional_network_best.pkl".format(save_path))
    except OSError:
        pass
开发者ID:123fengye741,项目名称:pylearn2,代码行数:28,代码来源:test_convnet.py


示例3: test_avicenna

def test_avicenna():
    """test that train/valid/test sets load (when standardize=False/true)."""
    skip_if_no_data()
    data = Avicenna(which_set='train', standardize=False)
    assert data.X.shape == (150205, 120)

    data = Avicenna(which_set='valid', standardize=False)
    assert data.X.shape == (4096, 120)

    data = Avicenna(which_set='test', standardize=False)
    assert data.X.shape == (4096, 120)

    # test that train/valid/test sets load (when standardize=True).
    data_train = Avicenna(which_set='train', standardize=True)
    assert data.X.shape == (150205, 120)

    data_valid = Avicenna(which_set='valid', standardize=True)
    assert data.X.shape == (4096, 120)

    data_test = Avicenna(which_set='test', standardize=True)
    assert data.X.shape == (4096, 120)

    dt = np.concatenate([data_train.X, data_valid.X, data_test.X], axis=0)
    assert np.allclose(dt.mean(), 0)
    assert np.allclose(dt.std(), 1.)
开发者ID:ecastrow,项目名称:pylearn2,代码行数:25,代码来源:test_avicenna.py


示例4: test_hepatitis

def test_hepatitis():
    """test hepatitis dataset"""
    skip_if_no_data()
    data = hepatitis.Hepatitis()
    assert data.X is not None
    assert np.all(data.X != np.inf)
    assert np.all(data.X != np.nan)
开发者ID:123fengye741,项目名称:pylearn2,代码行数:7,代码来源:test_hepatitis.py


示例5: setUp

 def setUp(self):
     """
     Attempts to load train and test
     """
     skip_if_no_data()
     self.train = MNIST_rotated_background(which_set='train')
     self.test = MNIST_rotated_background(which_set='test')
开发者ID:123fengye741,项目名称:pylearn2,代码行数:7,代码来源:test_mnist_rotated.py


示例6: Transform

def Transform():
    """Test smaller version of convolutional_network.ipynb"""
    which_experiment = "S100"
    skip.skip_if_no_data()
    yaml_file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
    data_dir = string_utils.preprocess("${PYLEARN2_DATA_PATH}")
    save_path = os.path.join(data_dir, "cifar10", "experiment_" + string.lower(which_experiment))
    base_save_path = os.path.join(data_dir, "cifar10")
    # Escape potential backslashes in Windows filenames, since
    # they will be processed when the YAML parser will read it
    # as a string
    # save_path.replace('\\', r'\\')

    yaml = open("{0}/experiment_base_transform.yaml".format(yaml_file_path), "r").read()
    hyper_params = {
        "batch_size": 64,
        "output_channels_h1": 64,
        "output_channels_h2": 128,
        "output_channels_h3": 600,
        "max_epochs": 100,
        "save_path": save_path,
        "base_save_path": base_save_path,
    }
    yaml = yaml % (hyper_params)
    train = yaml_parse.load(yaml)
    train.main_loop()
开发者ID:CKehl,项目名称:pylearn2,代码行数:26,代码来源:train_experiment_base.py


示例7: test_iris

def test_iris():
    """Load iris dataset"""
    skip_if_no_data()
    data = iris.Iris()
    assert data.X is not None
    assert np.all(data.X != np.inf)
    assert np.all(data.X != np.nan)
开发者ID:123fengye741,项目名称:pylearn2,代码行数:7,代码来源:test_iris.py


示例8: test_ule

def test_ule():
    skip_if_no_data()
    # Test loading of transfer data
    train, valid, test, transfer = utlc.load_ndarray_dataset("ule",
                                                             normalize=True,
                                                             transfer=True)
    assert train.shape[0] == transfer.shape[0]
开发者ID:AlexArgus,项目名称:pylearn2,代码行数:7,代码来源:test_utlc.py


示例9: test

def test():
    skip_if_no_data()

    dirname = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')

    with open(os.path.join(dirname, 'sr_dataset.yaml'), 'r') as f:
        dataset = f.read()

    hyper_params = {'train_stop': 50}
    dataset = dataset % (hyper_params)

    with open(os.path.join(dirname, 'sr_model.yaml'), 'r') as f:
        model = f.read()

    with open(os.path.join(dirname, 'sr_algorithm.yaml'), 'r') as f:
        algorithm = f.read()

    hyper_params = {'batch_size': 10,
                    'valid_stop': 50050}
    algorithm = algorithm % (hyper_params)

    with open(os.path.join(dirname, 'sr_train.yaml'), 'r') as f:
        train = f.read()

    train = train % locals()

    train = yaml_parse.load(train)
    train.main_loop()
开发者ID:bobchennan,项目名称:pylearn2,代码行数:28,代码来源:test_softmaxreg.py


示例10: test

def test():
    skip_if_no_data()

    dirname = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')

    with open(os.path.join(dirname, 'sr_dataset.yaml'), 'r') as f:
        dataset = f.read()

    hyper_params = {'train_stop': 50}
    dataset = dataset % (hyper_params)

    with open(os.path.join(dirname, 'sr_model.yaml'), 'r') as f:
        model = f.read()

    with open(os.path.join(dirname, 'sr_algorithm.yaml'), 'r') as f:
        algorithm = f.read()

    hyper_params = {'batch_size': 10,
                    'valid_stop': 50050}
    algorithm = algorithm % (hyper_params)

    with open(os.path.join(dirname, 'sr_train.yaml'), 'r') as f:
        train = f.read()

    save_path = os.path.dirname(os.path.realpath(__file__))
    train = train % locals()

    train = yaml_parse.load(train)
    train.main_loop()

    try:
        os.remove("{}/softmax_regression.pkl".format(save_path))
        os.remove("{}/softmax_regression_best.pkl".format(save_path))
    except:
        pass
开发者ID:BloodNg,项目名称:pylearn2,代码行数:35,代码来源:test_softmaxreg.py


示例11: train_generic

def train_generic():
    PATH_TO_PYLEARN2_MODES_DIR = os.path.abspath('./model_pylearn2')
    PATH_TO_INPUT_DIR = os.path.abspath('./intermediate_files_pylearn2/toy_train/')
    PROJECT_NAME = 'toy_train'

    skip.skip_if_no_data()
    train_dbm_model(PATH_TO_PYLEARN2_MODES_DIR, PATH_TO_INPUT_DIR, PROJECT_NAME)
开发者ID:nalvdao,项目名称:let_s_analyze_miss_collection_girls,代码行数:7,代码来源:train_model_pylearn2.py


示例12: test_FoveatedNORB

def test_FoveatedNORB():
    """
    This function tests the FoveatedNORB class. In addition to the shape and
    datatype of X and y member of the returned object, it also checks the
    scale of data while passing different parameters to the constructor.
    """
    skip_if_no_data()
    data = FoveatedNORB('train')
    datamin = data.X.min()
    datamax = data.X.max()
    assert data.X.shape == (24300, 8976)
    assert data.X.dtype == 'float32'
    assert data.y.shape == (24300, )
    assert data.y_labels == 5
    assert data.get_topological_view().shape == (24300, 96, 96, 2)

    data = FoveatedNORB('train', center=True)
    assert data.X.min() == datamin - 127.5
    assert data.X.max() == datamax - 127.5

    data = FoveatedNORB('train', center=True, scale=True)
    assert numpy.all(data.X <= 1.)
    assert numpy.all(data.X >= -1.)

    data = FoveatedNORB('train', scale=True)
    assert numpy.all(data.X <= 1.)
    assert numpy.all(data.X >= 0.)

    data = FoveatedNORB('test')
    assert data.X.shape == (24300, 8976)
    assert data.X.dtype == 'float32'
    assert data.y.shape == (24300, )
    assert data.y_labels == 5
    assert data.get_topological_view().shape == (24300, 96, 96, 2)
开发者ID:123fengye741,项目名称:pylearn2,代码行数:34,代码来源:test_norb_small.py


示例13: train_convolutional_network

def train_convolutional_network(yaml_with_hyper_params):

    skip.skip_if_no_data()

    train = yaml_parse.load(yaml_with_hyper_params)

    train.main_loop()
开发者ID:jvarley,项目名称:pylearn_rgbd_cnn,代码行数:7,代码来源:train_convnet.py


示例14: test_avicenna

def test_avicenna():
    """test that train/valid/test sets load (when standardize=False/true)."""
    skip_if_no_data()
    data = Avicenna(which_set='train', standardize=False)
    assert data.X.shape == (150205, 120)

    data = Avicenna(which_set='valid', standardize=False)
    assert data.X.shape == (4096, 120)

    data = Avicenna(which_set='test', standardize=False)
    assert data.X.shape == (4096, 120)

    # test that train/valid/test sets load (when standardize=True).
    data_train = Avicenna(which_set='train', standardize=True)
    assert data_train.X.shape == (150205, 120)

    data_valid = Avicenna(which_set='valid', standardize=True)
    assert data_valid.X.shape == (4096, 120)

    data_test = Avicenna(which_set='test', standardize=True)
    assert data_test.X.shape == (4096, 120)

    dt = np.concatenate([data_train.X, data_valid.X, data_test.X], axis=0)
    # Force double precision to compute mean and std, otherwise the test
    # fails because of precision.
    assert np.allclose(dt.mean(dtype='float64'), 0)
    assert np.allclose(dt.std(dtype='float64'), 1.)
开发者ID:123fengye741,项目名称:pylearn2,代码行数:27,代码来源:test_avicenna.py


示例15: main

def main():
    skip.skip_if_no_data()

    # setting
    data_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data'))
    save_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'pylearn2/result'))
    yaml_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'pylearn2/yaml'))

    # set hyper parameter
    yaml = open("{0}/conv_sample.yaml".format(yaml_path), 'r').read()
    hyper_params = {'train_stop': 50,
                    'valid_stop': 50050,
                    'test_stop': 50,
                    'batch_size': 50,
                    'output_channels_h0': 2,
                    'output_channels_h1': 2,
                    'max_epochs': 10,
                    'data_path': data_path,
                    'save_path': save_path}



    yaml = yaml % (hyper_params)

    # train
    train = yaml_parse.load(yaml)
    train.main_loop()
开发者ID:Kaoschuks,项目名称:nupic_image_recognition,代码行数:27,代码来源:train_conv.py


示例16: setUp

 def setUp(self):
     skip_if_no_data()
     self.train_set = CIFAR100(which_set='train')
     self.test_set = CIFAR100(which_set='test')
     assert not np.any(np.isnan(self.train_set.X))
     assert not np.any(np.isinf(self.train_set.X))
     assert not np.any(np.isnan(self.test_set.X))
     assert not np.any(np.isinf(self.test_set.X))
开发者ID:capybaralet,项目名称:pylearn2,代码行数:8,代码来源:test_cifar100.py


示例17: test_cos_dataset

def test_cos_dataset():
    """Tests if the dataset generator yields the desired value."""
    skip_if_no_data()
    dataset = CosDataset()

    sample_batch = dataset.get_batch_design(batch_size=10000)
    assert sample_batch.shape == (10000, 2)
    assert sample_batch[:, 0].min() >= dataset.min_x
    assert sample_batch[:, 0].max() <= dataset.max_x
开发者ID:123fengye741,项目名称:pylearn2,代码行数:9,代码来源:test_cos_dataset.py


示例18: setUp

 def setUp(self):
     """Load the train and test sets; check for nan and inf."""
     skip_if_no_data()
     self.train_set = CIFAR100(which_set='train')
     self.test_set = CIFAR100(which_set='test')
     assert not np.any(np.isnan(self.train_set.X))
     assert not np.any(np.isinf(self.train_set.X))
     assert not np.any(np.isnan(self.test_set.X))
     assert not np.any(np.isinf(self.test_set.X))
开发者ID:123fengye741,项目名称:pylearn2,代码行数:9,代码来源:test_cifar100.py


示例19: test_all_utlc

def test_all_utlc():
    skip_if_no_data()
    for name in ['avicenna','harry','ule']:   # not testing rita, because it requires a lot of memorz and is slow
        print "Loading ", name
        train, valid, test = utlc.load_ndarray_dataset(name, normalize=True)
        print "dtype, max, min, mean, std"
        print train.dtype, train.max(), train.min(), train.mean(), train.std()
        assert isinstance(train, numpy.ndarray), "train is not an ndarray in %s dataset" % name
        assert isinstance(valid, numpy.ndarray), "valid is not an ndarray in %s dataset" % name
        assert isinstance(test, numpy.ndarray), "test is not an ndarray in %s dataset" % name
        assert train.shape[1]==test.shape[1]==valid.shape[1], "shapes of datasets does not match for %s" % name
开发者ID:BloodD,项目名称:pylearn2,代码行数:11,代码来源:test_utlc.py


示例20: test_sda

def test_sda():

    skip.skip_if_no_data()

    yaml_file_path = '.';
    save_path = '.'

    train_layer1(yaml_file_path, save_path)
    train_layer2(yaml_file_path, save_path)
    train_layer3(yaml_file_path, save_path)
    train_mlp(yaml_file_path, save_path)
开发者ID:dsanno,项目名称:pylearn2_mnist,代码行数:11,代码来源:test_dae.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python train.Train类代码示例发布时间:2022-05-25
下一篇:
Python space.VectorSpace类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap