In [1]:
from nilmtk import DataSet, MeterGroup
import warnings
warnings.filterwarnings("ignore")
In [2]:
ds = DataSet("/Users/nipunbatra/Downloads/wikienergy-2.h5")
In [3]:
from nilmtk.disaggregate import CombinatorialOptimisation
In [4]:
co = CombinatorialOptimisation()
In [5]:
building_num = 11
In [6]:
elec = ds.buildings[building_num].elec
Reducing time window
In [7]:
ds.set_window(start='2014-04-01 00:00:00', end='2014-05-01 00:00:00')
In [8]:
elec
Out[8]:
In [9]:
fridge_elecmeter = elec['fridge']
In [10]:
fridge_elecmeter
Out[10]:
In [11]:
fridge_mg = MeterGroup([fridge_elecmeter])
In [12]:
co.train(fridge_mg)
In [13]:
co.model
Out[13]:
So, fridge is learnt as a 3 state appliance. What if we wanted to specify it to use 2 states? The latest version of nilmtk allows us to specify the number of states for an appliance.
In [14]:
num_states_dict = {fridge_elecmeter:2}
In [15]:
co = CombinatorialOptimisation()
co.train(fridge_mg, num_states_dict=num_states_dict)
In [16]:
co.model
Out[16]:
Now, fridge is learnt as a 2 state appliance.
Let us try the same thing with FHMM now
In [17]:
from nilmtk.disaggregate import FHMM
In [18]:
f = FHMM()
In [19]:
f.train(fridge_mg)
In [20]:
f.model.means_
Out[20]:
In [21]:
f = FHMM()
f.train(fridge_mg, num_states_dict)
In [22]:
f.model.means_
Out[22]:
So, now we have a 2 state learnt model for the Fridge.
In [ ]: