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


/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,
    target_is_start_and_end_and_mean=True,
    y_processing_func=lambda y: y / 300
)


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 [5]:
X, y = source._gen_data()
X, y = source._process_data(X, y)

In [6]:
y


Out[6]:
array([[[ 0.1015625 ],
        [ 0.29882812],
        [ 0.81066012]],

       [[ 0.1015625 ],
        [ 0.77148438],
        [ 0.3264966 ]],

       [[ 0.1015625 ],
        [ 0.96484375],
        [ 0.3912029 ]],

       [[ 0.1015625 ],
        [ 0.88867188],
        [ 0.29119933]],

       [[ 0.        ],
        [ 0.        ],
        [ 0.        ]],

       [[ 0.1015625 ],
        [ 0.86914062],
        [ 0.29541981]],

       [[ 0.1015625 ],
        [ 0.578125  ],
        [ 0.27867484]],

       [[ 0.1015625 ],
        [ 0.29296875],
        [ 0.28210881]],

       [[ 0.09960938],
        [ 0.6953125 ],
        [ 0.29156283]],

       [[ 0.1015625 ],
        [ 0.28515625],
        [ 0.83897156]],

       [[ 0.1015625 ],
        [ 0.30078125],
        [ 0.28516334]],

       [[ 0.1015625 ],
        [ 0.28515625],
        [ 0.83897156]],

       [[ 0.1015625 ],
        [ 0.60546875],
        [ 0.30780363]],

       [[ 0.        ],
        [ 0.        ],
        [ 0.        ]],

       [[ 0.1015625 ],
        [ 0.96484375],
        [ 0.21797888]],

       [[ 0.1015625 ],
        [ 0.60546875],
        [ 0.28851423]],

       [[ 0.1015625 ],
        [ 0.7421875 ],
        [ 0.28945121]],

       [[ 0.1015625 ],
        [ 0.63867188],
        [ 0.28761208]],

       [[ 0.1015625 ],
        [ 0.67773438],
        [ 0.28509036]],

       [[ 0.1015625 ],
        [ 0.296875  ],
        [ 0.28413332]],

       [[ 0.1015625 ],
        [ 0.61328125],
        [ 0.28479645]],

       [[ 0.1015625 ],
        [ 0.70117188],
        [ 0.28578717]],

       [[ 0.1015625 ],
        [ 0.296875  ],
        [ 0.81168336]],

       [[ 0.1015625 ],
        [ 0.3046875 ],
        [ 0.28999999]],

       [[ 0.1015625 ],
        [ 0.29101562],
        [ 0.28298968]],

       [[ 0.1015625 ],
        [ 0.79296875],
        [ 0.30400187]],

       [[ 0.        ],
        [ 0.        ],
        [ 0.        ]],

       [[ 0.        ],
        [ 0.        ],
        [ 0.        ]],

       [[ 0.1015625 ],
        [ 0.69726562],
        [ 0.28702733]],

       [[ 0.1015625 ],
        [ 0.8359375 ],
        [ 0.28381205]],

       [[ 0.1015625 ],
        [ 0.296875  ],
        [ 0.28489995]],

       [[ 0.1015625 ],
        [ 0.29882812],
        [ 0.28630361]],

       [[ 0.1015625 ],
        [ 0.63867188],
        [ 0.28761208]],

       [[ 0.09765625],
        [ 0.36523438],
        [ 0.28068128]],

       [[ 0.1015625 ],
        [ 0.296875  ],
        [ 0.29186663]],

       [[ 0.1015625 ],
        [ 0.671875  ],
        [ 0.2939041 ]],

       [[ 0.1015625 ],
        [ 0.29492188],
        [ 0.30814812]],

       [[ 0.1015625 ],
        [ 0.86914062],
        [ 0.29541981]],

       [[ 0.        ],
        [ 0.        ],
        [ 0.        ]],

       [[ 0.1015625 ],
        [ 0.2890625 ],
        [ 0.2846528 ]],

       [[ 0.1015625 ],
        [ 0.29492188],
        [ 0.28488213]],

       [[ 0.1015625 ],
        [ 0.69726562],
        [ 0.28702733]],

       [[ 0.1015625 ],
        [ 0.58789062],
        [ 0.4549264 ]],

       [[ 0.1015625 ],
        [ 0.30078125],
        [ 0.28473851]],

       [[ 0.1015625 ],
        [ 0.3125    ],
        [ 0.28842589]],

       [[ 0.1015625 ],
        [ 0.296875  ],
        [ 0.80303323]],

       [[ 0.1015625 ],
        [ 0.99804688],
        [ 0.2828286 ]],

       [[ 0.1015625 ],
        [ 0.66992188],
        [ 0.28171819]],

       [[ 0.        ],
        [ 0.        ],
        [ 0.        ]],

       [[ 0.        ],
        [ 0.        ],
        [ 0.        ]],

       [[ 0.1015625 ],
        [ 0.29296875],
        [ 0.28751701]],

       [[ 0.        ],
        [ 0.        ],
        [ 0.        ]],

       [[ 0.1015625 ],
        [ 0.65820312],
        [ 0.30921635]],

       [[ 0.1015625 ],
        [ 0.296875  ],
        [ 0.29379997]],

       [[ 0.        ],
        [ 0.        ],
        [ 0.        ]],

       [[ 0.1015625 ],
        [ 0.3046875 ],
        [ 0.28871793]],

       [[ 0.1015625 ],
        [ 0.91796875],
        [ 0.28940192]],

       [[ 0.1015625 ],
        [ 0.296875  ],
        [ 0.28849998]],

       [[ 0.1015625 ],
        [ 0.296875  ],
        [ 0.28489995]],

       [[ 0.1015625 ],
        [ 0.65625   ],
        [ 0.28388497]],

       [[ 0.1015625 ],
        [ 0.296875  ],
        [ 0.28481665]],

       [[ 0.1015625 ],
        [ 0.98242188],
        [ 0.22240575]],

       [[ 0.1015625 ],
        [ 0.7109375 ],
        [ 0.29710466]],

       [[ 0.1015625 ],
        [ 0.29296875],
        [ 0.28397956]]])

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 [ ]: