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


Python RealApplianceSource.output_shape_after_processing方法代码示例

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


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

示例1: exp_a

# 需要导入模块: from neuralnilm import RealApplianceSource [as 别名]
# 或者: from neuralnilm.RealApplianceSource import output_shape_after_processing [as 别名]
def exp_a(name):
    global source
    source_dict_copy = deepcopy(source_dict)
    source = RealApplianceSource(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(
        experiment_name=name,
        source=source
    ))
    N = 512
    output_shape = source.output_shape_after_processing()
    net_dict_copy['layers_config'] = [
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # (batch, features, time)
        },
        {
            'type': Conv1DLayer, # convolve over the time axis
            'num_filters': 32,
            'filter_length': 4,
            'stride': 1,
            'nonlinearity': rectify,
            'border_mode': 'same'
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1) # back to (batch, time, features)
        },
        {
            'type': DenseLayer,
            'num_units': N * 2,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': N,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': N // 2,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': output_shape[1] * output_shape[2],
            'nonlinearity': sigmoid
        }
    ]
    net = Net(**net_dict_copy)
    return net
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:53,代码来源:e354.py

示例2: exp_a

# 需要导入模块: from neuralnilm import RealApplianceSource [as 别名]
# 或者: from neuralnilm.RealApplianceSource import output_shape_after_processing [as 别名]
def exp_a(name):
    global source
    source_dict_copy = deepcopy(source_dict)
    source = RealApplianceSource(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(
        experiment_name=name,
        source=source
    ))
    output_shape = source.output_shape_after_processing()
    net_dict_copy['layers_config'] = [
        {
            'type': BLSTMLayer,
            'num_units': 40,
            'gradient_steps': GRADIENT_STEPS,
            'peepholes': False,
            'nonlinearity_cell': rectify,
            'nonlinearity_out': rectify
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)
        },
        {
            'type': Conv1DLayer,
            'num_filters': 20,
            'filter_length': 4,
            'stride': 4,
            'nonlinearity': rectify
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)
        },
        {
            'type': BLSTMLayer,
            'num_units': 80,
            'gradient_steps': GRADIENT_STEPS,
            'peepholes': False,
            'nonlinearity_cell': rectify,
            'nonlinearity_out': rectify
        },
        {
            'type': DenseLayer,
            'num_units': source.n_outputs,
            'nonlinearity': T.nnet.softplus
        }
    ]
    net = Net(**net_dict_copy)
    return net
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:52,代码来源:e364.py

示例3: exp_c

# 需要导入模块: from neuralnilm import RealApplianceSource [as 别名]
# 或者: from neuralnilm.RealApplianceSource import output_shape_after_processing [as 别名]
def exp_c(name):
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy['random_window'] = 256
    source = RealApplianceSource(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(
        experiment_name=name,
        source=source,
        learning_rate=1e-5
    ))
    N = 512 * 8
    output_shape = source.output_shape_after_processing()
    net_dict_copy['layers_config'] = [
        {
            'type': DenseLayer,
            'num_units': N * 2,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': N,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': N // 2,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': N // 4,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': output_shape[1] * output_shape[2],
            'nonlinearity': sigmoid
        }
    ]
    net = Net(**net_dict_copy)
    net.load_params(30000)
    return net
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:45,代码来源:e359.py

示例4: exp_a

# 需要导入模块: from neuralnilm import RealApplianceSource [as 别名]
# 或者: from neuralnilm.RealApplianceSource import output_shape_after_processing [as 别名]
def exp_a(name):
    # conv, conv
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(dict(logger=logging.getLogger(name)))
    source = RealApplianceSource(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(experiment_name=name, source=source))
    NUM_FILTERS = 16
    target_seq_length = source.output_shape_after_processing()[1]
    net_dict_copy["layers_config"] = [
        {"type": DimshuffleLayer, "pattern": (0, 2, 1)},  # (batch, features, time)
        {
            "type": Conv1DLayer,  # convolve over the time axis
            "num_filters": NUM_FILTERS,
            "filter_size": 4,
            "stride": 1,
            "nonlinearity": None,
            "border_mode": "valid",
        },
        {
            "type": Conv1DLayer,  # convolve over the time axis
            "num_filters": NUM_FILTERS,
            "filter_size": 4,
            "stride": 1,
            "nonlinearity": None,
            "border_mode": "valid",
        },
        {"type": DimshuffleLayer, "pattern": (0, 2, 1)},  # back to (batch, time, features)
        {"type": DenseLayer, "num_units": 512, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": 512, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": 512, "nonlinearity": rectify},
        {"type": DenseLayer, "num_units": target_seq_length, "nonlinearity": None},
    ]
    net = Net(**net_dict_copy)
    return net
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:38,代码来源:e529.py

示例5: exp_a

# 需要导入模块: from neuralnilm import RealApplianceSource [as 别名]
# 或者: from neuralnilm.RealApplianceSource import output_shape_after_processing [as 别名]
def exp_a(name):
    # conv, conv
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(dict(
        logger=logging.getLogger(name)
    ))
    source = RealApplianceSource(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(
        experiment_name=name,
        source=source
    ))
    NUM_FILTERS = 16
    target_seq_length = source.output_shape_after_processing()[1]
    net_dict_copy['layers_config'] = [
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # (batch, features, time)
        },
        {
            'type': Conv1DLayer,  # convolve over the time axis
            'num_filters': NUM_FILTERS,
            'filter_size': 4,
            'stride': 1,
            'nonlinearity': None,
            'border_mode': 'valid'
        },
        {
            'type': Conv1DLayer,  # convolve over the time axis
            'num_filters': NUM_FILTERS,
            'filter_size': 4,
            'stride': 1,
            'nonlinearity': None,
            'border_mode': 'valid'
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # back to (batch, time, features)
        },
        {
            'type': DenseLayer,
            'num_units': 512,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': 512,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': 512,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': target_seq_length,
            'nonlinearity': None
        }
    ]
    net = Net(**net_dict_copy)
    return net
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:65,代码来源:e526.py

示例6: exp_a

# 需要导入模块: from neuralnilm import RealApplianceSource [as 别名]
# 或者: from neuralnilm.RealApplianceSource import output_shape_after_processing [as 别名]
def exp_a(name):
    # conv, conv
    global source
    source_dict_copy = deepcopy(source_dict)
    source_dict_copy.update(dict(
        logger=logging.getLogger(name)
    ))
    source = RealApplianceSource(**source_dict_copy)
    net_dict_copy = deepcopy(net_dict)
    net_dict_copy.update(dict(
        experiment_name=name,
        source=source
    ))
    NUM_FILTERS = 16
    target_seq_length = source.output_shape_after_processing()[1]
    net_dict_copy['layers_config'] = [
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1)  # (batch, features, time)
        },
        {
            'type': Conv1DLayer,  # convolve over the time axis
            'num_filters': NUM_FILTERS,
            'filter_size': 4,
            'stride': 1,
            'nonlinearity': None,
            'border_mode': 'valid'
        },
        #  Need to do ugly dimshuffle, reshape, reshape, dimshuffle
        #  to get output of first Conv1DLayer ready for
        #  ConcatLayer
        # {
        #     'type': DimshuffleLayer,
        #     'pattern': (0, 2, 1),  # back to (batch, time, features)
        #     'label': 'dimshuffle1'
        # },
        # {
        #     'type': ReshapeLayer,
        #     'shape': (N_SEQ_PER_BATCH, -1),
        #     'label': 'reshape0'
        # },
        # {
        #     'type': ReshapeLayer,
        #     'shape': (N_SEQ_PER_BATCH, NUM_FILTERS, -1)
        # },
        # {
        #     'type': DimshuffleLayer,
        #     'pattern': (0, 2, 1),  # back to (batch, time, features)
        #     'label': 'dimshuffle2'
        # },
        {
            'type': Conv1DLayer,  # convolve over the time axis
            'num_filters': NUM_FILTERS,
            'filter_size': 4,
            'stride': 1,
            'nonlinearity': None,
            'border_mode': 'valid'
        },
        {
            'type': DimshuffleLayer,
            'pattern': (0, 2, 1),  # back to (batch, time, features)
            'label': 'dimshuffle3'
        },
        {
            'type': DenseLayer,
            'num_units': 512,
            'nonlinearity': rectify,
            'label': 'dense0'
        },
        {
            'type': DenseLayer,
            'num_units': 512,
            'nonlinearity': rectify,
            'label': 'dense1'
        },
        {
            'type': DenseLayer,
            'num_units': 512,
            'nonlinearity': rectify,
            'label': 'dense2'
        },
        {
            'type': ConcatLayer,
            'axis': 1,
            'incomings': ['dense0', 'dense2']
        },
        {
            'type': DenseLayer,
            'num_units': 512,
            'nonlinearity': rectify
        },
        {
            'type': DenseLayer,
            'num_units': target_seq_length,
            'nonlinearity': None
        }
    ]
    net = Net(**net_dict_copy)
    return net
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:101,代码来源:e532.py


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