Пример #1
0
def run(root_experiment_name):
    activations = load_nilmtk_activations(appliances=APPLIANCES,
                                          filename=NILMTK_FILENAME,
                                          sample_period=SAMPLE_PERIOD,
                                          windows=WINDOWS)

    for get_net in [ae]:
        for target_appliance in ['kettle']:
            pipeline = get_pipeline(target_appliance, activations)

            # Build net
            batch = pipeline.get_batch()
            net = get_net(batch)

            # Trainer
            trainer = Trainer(
                net=net,
                data_pipeline=pipeline,
                experiment_id=[
                    root_experiment_name, get_net.__name__, target_appliance
                ],
                metrics=Metrics(
                    state_boundaries=[2]),  # was 3 up until 230000ish
                learning_rates={0: 1E-2},
                repeat_callbacks=[(5000, Trainer.validate),
                                  (5000, Trainer.save_params),
                                  (5000, Trainer.plot_estimates)])

            report = trainer.submit_report()
            print(report)

            # Run!
            trainer.fit(None)
Пример #2
0
def run(root_experiment_name):
    activations = load_nilmtk_activations(appliances=APPLIANCES,
                                          filename=NILMTK_FILENAME,
                                          sample_period=SAMPLE_PERIOD,
                                          windows=WINDOWS)

    for get_net in [ae]:
        for target_appliance in APPLIANCES[2:]:
            print("Starting training for net {}, appliance {}.".format(
                get_net.__name__, target_appliance))
            pipeline = get_pipeline(target_appliance, activations)

            # Build net
            batch = pipeline.get_batch()
            net = get_net(batch)

            # Trainer
            trainer = Trainer(net=net,
                              data_pipeline=pipeline,
                              experiment_id=[
                                  root_experiment_name, get_net.__name__,
                                  target_appliance
                              ],
                              metrics=Metrics(state_boundaries=[2.5]),
                              learning_rates={
                                  0: 1e-2,
                                  200000: 1e-3
                              },
                              repeat_callbacks=[(25000, Trainer.validate),
                                                (25000, Trainer.save_params),
                                                (25000, Trainer.plot_estimates)
                                                ])

            report = trainer.submit_report()
            print(report)

            # Run!
            trainer.fit(300000)