# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Run the CO-Algorithm on the HIPE data set

# In this notebook we use NILMTK's rapid experimentation API to run the CO algorithm on two appliances of the HIPE data set. The goal is to verify that the framework and the transformed data are behaving as expected.

from nilmtk.api import API
from nilmtk.disaggregate import CO, Mean, FHMMExact, Hart85

hipe = {
  "power": {
    "mains": ["apparent"],
    "appliance": ["active"]
  },
  'sample_rate': 60,
  'artificial_aggregate': True,
  'appliances': [9,10],
  'methods': {
      "CO":CO({}),
      'Mean': Mean({}),
      #"FHMM_EXACT":FHMMExact({'num_of_states':2})
  },
  'train': {    
    'datasets': {
        'HIPE': {
            'path': '../test_1week.hdf',
            'buildings': {
                1: {
                    'start_time': '2017-10-23',
                    'end_time': '2017-10-24'
                    }
                }                
            }
        }
    },
  'test': {
    'datasets': {
        'HIPE': {
            'path': '../test_1week.hdf',
            'buildings': {
                1: {
                    'start_time': '2017-10-24',
                    'end_time': '2017-10-30'
                    }
                }
            }
        },
        'metrics':['rmse','f1score','mae']
    }
}

hipe_results = API(hipe)

errors_keys = hipe_results.errors_keys
errors = hipe_results.errors
for i in range(len(errors)):
    print (errors_keys[i])
    print (errors[i])
    print ("\n\n")



StarcoderdataJupyterScriptsDedupFiltered