60
Metadata for Energy and working with Python Jack Kelly Imperial College London [email protected]

Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London [email protected]. Outline 1. ... CSV

Embed Size (px)

Citation preview

Page 1: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Metadata for Energyand working with Python

Jack KellyImperial College [email protected]

Page 2: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Outline

1. What is energy disaggregation?

2. My dataset: UK­DALE

3. Open­source Python tool: NILMTK

4. Metadata

Page 3: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

What is energy disaggregation?

Page 4: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 5: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 6: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 7: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

UK­DALE: UK Disaggregated Appliance­Level Energy data

● 5 homes● Duration: 39 days to 3.5 years of data per house● Once every 6 seconds records whole­house 

apparent power and appliance power demand● CSV with YAML metadata● HDF5 version● Records whole­house voltage and current at 16kHz 

for 3 homes (stored as hourly FLAC files)● 6 terabytes● Recording hardware: off­the­shelf and DIY● Available on UKERC EDC (with DOIs) and FTP● Paper in NPG's Scientific Data journal

Page 8: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 9: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 10: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 11: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 12: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 13: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 14: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 15: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 16: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 17: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Open­source Python disaggregation toolkit: NILMTK

● nilmtk.github.io● (NILM = Non­Intrusive Load Monitoring)● Imports 11 datasets to standard format using 

HDF5 and detailed metadata● Data cleaning, summary statistics, plotting etc.● 6 NILM algorithms (1 hosted by algo author)● NILM metrics● Can process more data than can fit into RAM● Documentation and code examples● Issue queue (501); mailing list; twitter; wiki

Page 18: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 19: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 20: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

NILMTK: What worked well?

● 11 dataset importers: lots of contributed code● Stand­alone data conversion scripts are simple to write● People definitely tinker with NILMTK and cite it● Not clear how many people use it for productive work!● 6 NILM algorithms (although this required a lot of effort)● Lots of discussions on the issue queue● Lazy loading & out­of­core is powerful (but complex)● Built on existing packages (Pandas etc.)● TESTS!  ● Continuous integration (Travis­CI)

Page 21: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

NILMTK: What didn't work well?

● Out­of­core is perhaps not worth the effort: makes the code much more complex.  Instead use Blaze?

● Too “monolithic”. Should interact with existing tools more naturally.  Perhaps separate NILMTK into separate tools?

● Documentation needs to be extensive but up­to­date.  This is hard work!

● Issue queue is hard work. Lots of “I don't know how to use Python; please hold my hand”.

● “Need to move to stand still”: keeping up to date with new versions of dependencies (Pandas etc.)

Page 22: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

NILMTK: Conclusions

● KISS (especially if you want 3rd party contributions)● Focus on high­quality documentation for users: will save 

you time in the long­run● Make full use of automatic package managers so users can 

install your code & dependencies easily

Page 23: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Datasets are complex

● Many meters● Each connected to some number of appliances● Arbitrary wiring between meters● Different meter models● Specify details of appliances● Preprocessing applied to data● etc.

Page 24: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

NILM Metadata schema

● YAML (YAML Ain't Markup Language)● Controlled vocab, object inheritance● Schema has 2 components:

Schema for describing individual datasetsDataset, buildings, meters, appliances, measurements

Common metadata about appliance typesCategories, priors, models of appliances, countries

Page 25: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 26: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 27: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 28: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

dataset.yaml

Page 29: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 30: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 31: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 32: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 33: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 34: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

meter_devices.yaml

Page 35: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 36: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 37: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 38: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

# building1.yaml

appliances:­ type: washer dryer  instance: 1  meters: [10, 20]  components:  ­ type: motor    meters: [10]  ­ type: electric heating element    meters: [20]

Example of an appliance containing other 'appliances'

Page 39: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 40: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 41: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 42: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 43: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 44: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 45: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV
Page 46: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 47: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 48: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 49: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 50: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 51: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 52: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 53: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 54: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 55: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 56: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 57: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of dataset metadata

Page 58: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

Example of central metadata

Page 59: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

NILM Metadata schema in use

● Used by NILMTK● At least 11 datasets use NILM Metadata● github.com/NILMTK/NILM_Metadata● Lots of contributions to controlled vocabulary

Page 60: Metadata for Energy and working with Python - Bath · Metadata for Energy and working with Python Jack Kelly Imperial College London jack.kelly@imperial.ac.uk. Outline 1. ... CSV

NILM Metadata: future work?

● Make it as easy as possible to use: simple profile?● e.g. detailed appliance metadata not very useful?● Re­skin as RDF and OWL?!● Defaults● Wizard● Validator● Micro generation