本文整理汇总了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
示例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
示例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
示例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
示例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
示例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