本文整理汇总了Python中neuralnilm.Net.compile方法的典型用法代码示例。如果您正苦于以下问题:Python Net.compile方法的具体用法?Python Net.compile怎么用?Python Net.compile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neuralnilm.Net
的用法示例。
在下文中一共展示了Net.compile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_net
# 需要导入模块: from neuralnilm import Net [as 别名]
# 或者: from neuralnilm.Net import compile [as 别名]
def get_net(appliance, architecture):
"""
Parameters
----------
appliance : string
architecture : {'rnn', 'ae', 'rectangles'}
"""
NET_DICTS = {
'rnn': net_dict_rnn,
'ae': net_dict_ae,
'rectangles': net_dict_rectangles
}
net_dict_func = NET_DICTS[architecture]
source = get_source(
appliance,
logger,
target_is_start_and_end_and_mean=(architecture == 'rectangles'),
is_rnn=(architecture == 'rnn'),
window_per_building={ # just load a tiny bit of data. Won't be used.
1: ("2013-04-12", "2013-05-12"),
2: ("2013-05-22", "2013-06-22"),
3: ("2013-02-27", "2013-03-27"),
4: ("2013-03-09", "2013-04-09"),
5: ("2014-06-29", "2014-07-29")
},
source_type='real_appliance_source',
filename=UKDALE_FILENAME
)
seq_length = source.seq_length
net_dict = net_dict_func(seq_length)
if appliance == 'dish washer' and architecture == 'rectangles':
epochs = 200000
net_dict.pop('epochs')
else:
epochs = net_dict.pop('epochs')
net_dict_copy = deepcopy(net_dict)
experiment_name = EXPERIMENT + "_" + appliance + "_" + architecture
net_dict_copy.update(dict(
source=source,
logger=logger,
experiment_name=experiment_name
))
net = Net(**net_dict_copy)
net.plotter.max_target_power = source.max_appliance_powers.values()[0]
net.load_params(iteration=epochs,
path=join(NET_BASE_PATH, experiment_name))
net.print_net()
net.compile()
return net
示例2: Uniform
# 需要导入模块: from neuralnilm import Net [as 别名]
# 或者: from neuralnilm.Net import compile [as 别名]
'type': DimshuffleLayer,
'pattern': (0, 2, 1)
},
{
'type': Conv1DLayer,
'num_filters': 80,
'filter_length': 5,
'stride': 5,
'nonlinearity': sigmoid
},
{
'type': DimshuffleLayer,
'pattern': (0, 2, 1)
},
{
'type': LSTMLayer,
'num_units': 80,
'W_in_to_cell': Uniform(5)
},
{
'type': DenseLayer,
'num_units': source.n_outputs,
'nonlinearity': sigmoid
}
]
)
net.print_net()
net.compile()
net.fit()