In [1]:
%matplotlib inline
from __future__ import print_function, division
from nilmtk import DataSet
import numpy as np
import pandas as np
import matplotlib
matplotlib.rcParams['figure.figsize'] = (16.0, 8.0)
import matplotlib.pyplot as plt
import sys
from functools import partial
from neuralnilm.source import SameLocation
from neuralnilm.rectangulariser import rectangularise
/usr/local/lib/python2.7/dist-packages/scipy/lib/_util.py:67: DeprecationWarning: Module scipy.linalg.blas.fblas is deprecated, use scipy.linalg.blas instead
DeprecationWarning)
/home/dk3810/workspace/python/nntools/lasagne/init.py:86: UserWarning: The uniform initializer no longer uses Glorot et al.'s approach to determine the bounds, but defaults to the range (-0.01, 0.01) instead. Please use the new GlorotUniform initializer to get the old behavior. GlorotUniform is now the default for all layers.
warnings.warn("The uniform initializer no longer uses Glorot et al.'s "
In [2]:
N_SEGMENTS = 8
source = SameLocation(
filename='/data/mine/vadeec/merged/ukdale.h5',
window=("2013-03-18", "2013-03-29"),
target_appliance='fridge freezer',
seq_length=512,
train_buildings=[1],
validation_buildings=[1],
subsample_target=1,
n_seq_per_batch=64,
standardise_input=True,
ignore_incomplete=True,
allow_incomplete=True,
include_all=True,
skip_probability=0.25,
offset_probability=0,
n_rectangular_segments=N_SEGMENTS
)
Loaded 267 fridge freezer activations from house 1.
INFO:neuralnilm.source:Loaded 267 fridge freezer activations from house 1.
Loaded mains data for building 1.
INFO:neuralnilm.source:Loaded mains data for building 1.
In [3]:
X, y = source._gen_data()
X, y = source._process_data(X, y)
/usr/local/lib/python2.7/dist-packages/numpy/core/_methods.py:83: RuntimeWarning: Degrees of freedom <= 0 for slice
warnings.warn("Degrees of freedom <= 0 for slice", RuntimeWarning)
In [4]:
y
Out[4]:
array([[[ 0.1015625 ],
[ 0.01953125],
[ 0.34375 ],
[ 0.01171875],
[ 0.02734375],
[ 0.04882812],
[ 0.01367188],
[ 0.43359375]],
[[ 0.1015625 ],
[ 0.00390625],
[ 0.015625 ],
[ 0.04101562],
[ 0.02148438],
[ 0.1015625 ],
[ 0.19140625],
[ 0.5234375 ]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.1953125 ],
[ 0.69921875]],
[[ 0.1015625 ],
[ 0.00390625],
[ 0.1796875 ],
[ 0.34765625],
[ 0.05664062],
[ 0.12304688],
[ 0.17578125],
[ 0.01171875]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.00976562],
[ 0.10546875],
[ 0.07226562],
[ 0.70703125]],
[[ 0.1015625 ],
[ 0.00585938],
[ 0.01757812],
[ 0.0078125 ],
[ 0.07226562],
[ 0.01171875],
[ 0.08007812],
[ 0.703125 ]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.00976562],
[ 0.10546875],
[ 0.07226562],
[ 0.70703125]],
[[ 0.1015625 ],
[ 0.01757812],
[ 0.046875 ],
[ 0.31054688],
[ 0.06054688],
[ 0.04492188],
[ 0.0859375 ],
[ 0.33203125]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0.00585938],
[ 0.00976562],
[ 0.00390625],
[ 0.015625 ],
[ 0.078125 ],
[ 0.08007812],
[ 0.70507812]],
[[ 0.1015625 ],
[ 0.01757812],
[ 0.046875 ],
[ 0.19921875],
[ 0.27148438],
[ 0.0859375 ],
[ 0.04882812],
[ 0.22851562]],
[[ 0.1015625 ],
[ 0.02929688],
[ 0.02929688],
[ 0.11132812],
[ 0.23828125],
[ 0.04296875],
[ 0.0390625 ],
[ 0.40820312]],
[[ 0.1015625 ],
[ 0.02929688],
[ 0.02929688],
[ 0.11132812],
[ 0.23828125],
[ 0.04296875],
[ 0.0390625 ],
[ 0.40820312]],
[[ 0.1015625 ],
[ 0.01757812],
[ 0.171875 ],
[ 0.00585938],
[ 0.19335938],
[ 0.00585938],
[ 0.47070312],
[ 0.03320312]],
[[ 0.1015625 ],
[ 0.00585938],
[ 0.01171875],
[ 0.01367188],
[ 0.05664062],
[ 0.02734375],
[ 0.08007812],
[ 0.703125 ]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.00976562],
[ 0.10546875],
[ 0.07226562],
[ 0.70703125]],
[[ 0.1015625 ],
[ 0.00585938],
[ 0.00976562],
[ 0.01757812],
[ 0.0546875 ],
[ 0.05273438],
[ 0.05273438],
[ 0.70507812]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.60742188],
[ 0.28710938]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0.0078125 ],
[ 0.00976562],
[ 0.02148438],
[ 0.0390625 ],
[ 0.04296875],
[ 0.07617188],
[ 0.70117188]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.1953125 ],
[ 0.69921875]],
[[ 0.1015625 ],
[ 0.0078125 ],
[ 0.0078125 ],
[ 0.0234375 ],
[ 0.05273438],
[ 0.03320312],
[ 0.09179688],
[ 0.68164062]],
[[ 0.1015625 ],
[ 0.00390625],
[ 0.0234375 ],
[ 0.375 ],
[ 0.02734375],
[ 0.29882812],
[ 0.0703125 ],
[ 0.09960938]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0.01367188],
[ 0.11132812],
[ 0.15625 ],
[ 0.171875 ],
[ 0.05859375],
[ 0.06640625],
[ 0.3203125 ]],
[[ 0.1015625 ],
[ 0.00390625],
[ 0.06054688],
[ 0.11523438],
[ 0.19335938],
[ 0.08007812],
[ 0.04101562],
[ 0.40429688]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.19335938],
[ 0.70117188]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.19140625],
[ 0.703125 ]],
[[ 0.1015625 ],
[ 0.0078125 ],
[ 0.05078125],
[ 0.15820312],
[ 0.21289062],
[ 0.00585938],
[ 0.08789062],
[ 0.375 ]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0.00585938],
[ 0.0078125 ],
[ 0.00390625],
[ 0.015625 ],
[ 0.07421875],
[ 0.08789062],
[ 0.703125 ]],
[[ 0.1015625 ],
[ 0.00390625],
[ 0.05273438],
[ 0.0234375 ],
[ 0.05664062],
[ 0.04101562],
[ 0.00585938],
[ 0.71484375]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.19335938],
[ 0.70117188]],
[[ 0.1015625 ],
[ 0.00390625],
[ 0.00976562],
[ 0.00390625],
[ 0.09375 ],
[ 0.04101562],
[ 0.04492188],
[ 0.70117188]],
[[ 0.1015625 ],
[ 0.00390625],
[ 0.00976562],
[ 0.00390625],
[ 0.08398438],
[ 0.0234375 ],
[ 0.07421875],
[ 0.69921875]],
[[ 0.1015625 ],
[ 0.00390625],
[ 0.06445312],
[ 0.10546875],
[ 0.24804688],
[ 0.0625 ],
[ 0.04492188],
[ 0.36914062]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0.01757812],
[ 0.04492188],
[ 0.3828125 ],
[ 0.10351562],
[ 0.046875 ],
[ 0.00585938],
[ 0.296875 ]],
[[ 0.1015625 ],
[ 0.02929688],
[ 0.02929688],
[ 0.11132812],
[ 0.23828125],
[ 0.04296875],
[ 0.0390625 ],
[ 0.40820312]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.01171875],
[ 0.18554688],
[ 0.05273438],
[ 0.64453125]],
[[ 0.1015625 ],
[ 0.02148438],
[ 0.0546875 ],
[ 0.11914062],
[ 0.23242188],
[ 0.09570312],
[ 0.06445312],
[ 0.31054688]],
[[ 0.1015625 ],
[ 0.01757812],
[ 0.0546875 ],
[ 0.10742188],
[ 0.23046875],
[ 0.09765625],
[ 0.0703125 ],
[ 0.3203125 ]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0.0078125 ],
[ 0.0078125 ],
[ 0.0234375 ],
[ 0.04101562],
[ 0.0390625 ],
[ 0.07421875],
[ 0.70507812]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.19335938],
[ 0.70117188]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.56835938],
[ 0.32617188]],
[[ 0.1015625 ],
[ 0.01757812],
[ 0.171875 ],
[ 0.00585938],
[ 0.19335938],
[ 0.00585938],
[ 0.47070312],
[ 0.03320312]],
[[ 0.1015625 ],
[ 0.00585938],
[ 0.06054688],
[ 0.02148438],
[ 0.06054688],
[ 0.04492188],
[ 0.00585938],
[ 0.69921875]],
[[ 0.1015625 ],
[ 0.0078125 ],
[ 0.0078125 ],
[ 0.02539062],
[ 0.06054688],
[ 0.03320312],
[ 0.07226562],
[ 0.69140625]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0.00390625],
[ 0.58007812],
[ 0.31445312]],
[[ 0.1015625 ],
[ 0.0078125 ],
[ 0.05078125],
[ 0.15820312],
[ 0.21289062],
[ 0.00585938],
[ 0.08789062],
[ 0.375 ]],
[[ 0.1015625 ],
[ 0.01953125],
[ 0.20898438],
[ 0. ],
[ 0. ],
[ 0.00585938],
[ 0.49609375],
[ 0.16796875]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0. ],
[ 0.00390625],
[ 0.00976562],
[ 0.00390625],
[ 0.09570312],
[ 0.078125 ],
[ 0.70703125]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0.00585938],
[ 0.00390625],
[ 0.41992188],
[ 0.12109375],
[ 0.06835938],
[ 0.1171875 ],
[ 0.16210938]],
[[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 0. ],
[ 1. ]],
[[ 0.1015625 ],
[ 0.0078125 ],
[ 0.19921875],
[ 0.359375 ],
[ 0.1484375 ],
[ 0.04882812],
[ 0.06445312],
[ 0.0703125 ]]])
In [4]:
y.shape
Out[4]:
(8, 3, 1)
In [5]:
y
Out[5]:
array([[[ 0. ],
[ 0.00390625],
[ 0.99609375]],
[[ 0.1015625 ],
[ 0.859375 ],
[ 0.0390625 ]],
[[ 0.10351562],
[ 0.18554688],
[ 0.7109375 ]],
[[ 0.1015625 ],
[ 0.00390625],
[ 0.89453125]],
[[ 0.1015625 ],
[ 0.00390625],
[ 0.89453125]],
[[ 0.1015625 ],
[ 0.00390625],
[ 0.89453125]],
[[ 0.1015625 ],
[ 0.23632812],
[ 0.66210938]],
[[ 0.1015625 ],
[ 0.19921875],
[ 0.69921875]]])
In [ ]:
Content source: mmottahedi/neuralnilm_prototype
Similar notebooks: