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