本文整理汇总了Python中neuralnilm.experiment.run_experiment函数的典型用法代码示例。如果您正苦于以下问题:Python run_experiment函数的具体用法?Python run_experiment怎么用?Python run_experiment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_experiment函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: main
def main():
APPLIANCES = [
('a', ['fridge freezer', 'fridge'], 512),
('b', "'coffee maker'", 512),
('c', "'dish washer'", 2000),
('d', "'hair dryer'", 256),
('e', "'kettle'", 256),
('f', "'oven'", 2000),
('g', "'toaster'", 256),
('h', "'light'", 2000),
('i', ['washer dryer', 'washing machine'], 1504)
]
for experiment, appliance, seq_length in APPLIANCES[-1:]:
full_exp_name = NAME + experiment
func_call = init_experiment(PATH, 'a', full_exp_name)
func_call = func_call[:-1] + ", {}, {})".format(appliance, seq_length)
logger = logging.getLogger(full_exp_name)
try:
net = eval(func_call)
run_experiment(net, epochs=5000)
except KeyboardInterrupt:
logger.info("KeyboardInterrupt")
break
except Exception as exception:
logger.exception("Exception")
# raise
else:
del net.source
del net
gc.collect()
finally:
logging.shutdown()
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:32,代码来源:e498.py
示例2: main
def main():
for net_dict_func in [net_dict_ae_rnn]:
for appliance in ['microwave']:
full_exp_name = NAME + '_' + appliance + '_' + net_dict_func.name
change_dir(PATH, full_exp_name)
configure_logger(full_exp_name)
logger = logging.getLogger(full_exp_name)
global multi_source
multi_source = get_source(
appliance,
logger,
is_rnn=True
)
seq_length = multi_source.sources[0]['source'].seq_length
net_dict = net_dict_func(seq_length)
epochs = net_dict.pop('epochs')
try:
net = exp_a(full_exp_name, net_dict, multi_source)
net.experiment_name = 'e567_microwave_ae'
net.set_csv_filenames()
net.load_params(iteration=100000, path='/data/dk3810/figures/e567_microwave_ae')
net.experiment_name = full_exp_name
net.set_csv_filenames()
run_experiment(net, epochs=epochs)
except KeyboardInterrupt:
logger.info("KeyboardInterrupt")
break
except Exception:
logger.exception("Exception")
# raise
finally:
logging.shutdown()
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:32,代码来源:e573.py
示例3: main
def main():
APPLIANCES = [
("a", ["fridge freezer", "fridge"], 512),
("b", "'coffee maker'", 512),
("c", "'dish washer'", 2000),
("d", "'hair dryer'", 256),
("e", "'kettle'", 256),
("f", "'oven'", 2000),
("g", "'toaster'", 256),
("h", "'light'", 2000),
("i", ["washer dryer", "washing machine"], 1504),
]
for experiment, appliance, seq_length in APPLIANCES[-1:]:
full_exp_name = NAME + experiment
func_call = init_experiment(PATH, "a", full_exp_name)
func_call = func_call[:-1] + ", {}, {})".format(appliance, seq_length)
logger = logging.getLogger(full_exp_name)
try:
net = eval(func_call)
run_experiment(net, epochs=None)
except KeyboardInterrupt:
logger.info("KeyboardInterrupt")
break
except Exception as exception:
logger.exception("Exception")
# raise
else:
del net.source
del net
gc.collect()
finally:
logging.shutdown()
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:32,代码来源:e491.py
示例4: main
def main():
# for net_dict_func in [net_dict_ae, net_dict_rectangles, net_dict_rnn]:
for net_dict_func in [net_dict_ae, net_dict_rectangles]:
for appliance in ['microwave', 'kettle', 'dish washer']:
full_exp_name = NAME + '_' + appliance + '_' + net_dict_func.name
change_dir(PATH, full_exp_name)
configure_logger(full_exp_name)
logger = logging.getLogger(full_exp_name)
global multi_source
multi_source = get_source(
appliance,
logger,
target_is_start_and_end_and_mean=(net_dict_func == net_dict_rectangles),
is_rnn=(net_dict_func == net_dict_rnn)
)
seq_length = multi_source.sources[0]['source'].seq_length
net_dict = net_dict_func(seq_length)
epochs = net_dict.pop('epochs')
try:
net = exp_a(full_exp_name, net_dict, multi_source)
run_experiment(net, epochs=epochs)
except KeyboardInterrupt:
logger.info("KeyboardInterrupt")
break
except Exception:
logger.exception("Exception")
# raise
finally:
logging.shutdown()
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:29,代码来源:e567.py
示例5: main
def main():
global logger
EXPERIMENTS = list('abcdefghijklmnopqrstu')
for experiment in EXPERIMENTS:
full_exp_name = NAME + experiment
path = os.path.join(PATH, full_exp_name)
try:
os.mkdir(path)
except OSError as exception:
if exception.errno == 17:
print(path, "already exists. Reusing directory.")
else:
raise
os.chdir(path)
try:
net = init_experiment(experiment)
run_experiment(net, path, epochs=500)
except KeyboardInterrupt:
logger.info("KeyboardInterrupt")
break
except TrainingError as exception:
logger.exception()
except Exception as exception:
logger.exception()
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:25,代码来源:e276.py
示例6: main
def main():
for experiment in list('a'):
full_exp_name = NAME + experiment
path = os.path.join(PATH, full_exp_name)
try:
net = init_experiment(experiment)
run_experiment(net, path, epochs=5000)
except KeyboardInterrupt:
break
except TrainingError as e:
print("EXCEPTION:", e)
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:11,代码来源:e117.py
示例7: main
def main():
for experiment in list('a'):
full_exp_name = NAME + experiment
path = os.path.join(PATH, full_exp_name)
try:
net = init_experiment(experiment)
run_experiment(net, path, epochs=None)
except KeyboardInterrupt:
break
except TrainingError as exception:
print("EXCEPTION:", exception)
except Exception as exception:
print("EXCEPTION:", exception)
import ipdb; ipdb.set_trace()
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:14,代码来源:e154.py
示例8: main
def main():
experiment = "a"
full_exp_name = NAME + experiment
path = os.path.join(PATH, full_exp_name)
print("***********************************")
print("Preparing", full_exp_name, "...")
try:
net = exp_x(full_exp_name)
run_experiment(net, path, epochs=5000)
except KeyboardInterrupt:
return
except TrainingError as exception:
print("EXCEPTION:", exception)
except Exception as exception:
print("EXCEPTION:", exception)
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:15,代码来源:e257.py
示例9: main
def main():
# EXPERIMENTS = list('abcdefghijklmnopqrstuvwxyz')
EXPERIMENTS = list('z')
for experiment in EXPERIMENTS:
full_exp_name = NAME + experiment
func_call = init_experiment(PATH, experiment, full_exp_name)
logger = logging.getLogger(full_exp_name)
try:
net = eval(func_call)
run_experiment(net, epochs=None)
except KeyboardInterrupt:
logger.info("KeyboardInterrupt")
break
except Exception as exception:
logger.exception("Exception")
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:15,代码来源:e277.py
示例10: main
def main():
for experiment, learning_rate in [('a', 1.0), ('b', 0.1), ('c', 0.01),
('d', 0.001), ('e', 0.0001)]:
full_exp_name = NAME + experiment
path = os.path.join(PATH, full_exp_name)
print("***********************************")
print("Preparing", full_exp_name, "...")
try:
net = exp_x(full_exp_name, learning_rate)
run_experiment(net, path, epochs=1000)
except KeyboardInterrupt:
break
except TrainingError as exception:
print("EXCEPTION:", exception)
except Exception as exception:
print("EXCEPTION:", exception)
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:16,代码来源:e249.py
示例11: main
def main():
# for net_dict_func in [net_dict_ae, net_dict_rectangles, net_dict_rnn]:
for net_dict_func in [net_dict_rnn]:
# for appliance in ['microwave', 'washing machine',
# 'fridge', 'kettle', 'dish washer']:
for appliance in ['washing machine',
'fridge', 'kettle', 'dish washer']:
# REMOVE IF RUN FROM SCRATCH:
if net_dict_func == net_dict_ae:
if appliance in ['microwave', 'washing machine', 'dish washer']:
continue
elif net_dict_func == net_dict_rectangles:
if appliance == 'microwave':
continue
full_exp_name = NAME + '_' + appliance + '_' + net_dict_func.name
change_dir(PATH, full_exp_name)
configure_logger(full_exp_name)
logger = logging.getLogger(full_exp_name)
global multi_source
multi_source = get_source(
appliance,
logger,
target_is_start_and_end_and_mean=(net_dict_func == net_dict_rectangles),
is_rnn=(net_dict_func == net_dict_rnn)
)
seq_length = multi_source.sources[0]['source'].seq_length
net_dict = net_dict_func(seq_length)
epochs = net_dict.pop('epochs')
try:
net = exp_a(full_exp_name, net_dict, multi_source)
# REMOVE IF RUN FROM SCRATCH:
if (appliance == 'washing machine' and
net_dict_func == net_dict_rectangles):
net.load_params(85351)
if (appliance == 'washing machine' and
net_dict_func == net_dict_rnn):
net.load_params(4000)
run_experiment(net, epochs=epochs)
except KeyboardInterrupt:
logger.info("KeyboardInterrupt")
break
except Exception:
logger.exception("Exception")
# raise
finally:
logging.shutdown()
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:47,代码来源:e566.py
示例12: main
def main():
EXPERIMENTS = list('a')
for experiment in EXPERIMENTS:
full_exp_name = NAME + experiment
func_call = init_experiment(PATH, experiment, full_exp_name)
logger = logging.getLogger(full_exp_name)
try:
net = eval(func_call)
run_experiment(net, epochs=None)
except KeyboardInterrupt:
logger.info("KeyboardInterrupt")
break
except Exception:
logger.exception("Exception")
# raise
finally:
logging.shutdown()
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:17,代码来源:e554.py
示例13: main
def main():
EXPERIMENTS = list("a")
for experiment in EXPERIMENTS:
full_exp_name = NAME + experiment
func_call = init_experiment(PATH, experiment, full_exp_name)
logger = logging.getLogger(full_exp_name)
try:
net = eval(func_call)
run_experiment(net, epochs=None)
except KeyboardInterrupt:
logger.info("KeyboardInterrupt")
break
except Exception as exception:
logger.exception("Exception")
# raise
else:
del net.source.train_activations
gc.collect()
finally:
logging.shutdown()
开发者ID:mmottahedi,项目名称:neuralnilm_prototype,代码行数:20,代码来源:e426.py
注:本文中的neuralnilm.experiment.run_experiment函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论