Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics fails to execute on iAWE data set #406

Closed
nipunbatra opened this issue Jun 10, 2015 · 0 comments
Closed

metrics fails to execute on iAWE data set #406

nipunbatra opened this issue Jun 10, 2015 · 0 comments

Comments

@nipunbatra
Copy link
Member

The HDF5 file can be downloaded from here:https://copy.com/C2sIt1UfDx1mfPlC

Here is the minimal code to reproduce the error.

from nilmtk import DataSet
from nilmtk.disaggregate import CombinatorialOptimisation
from nilmtk.metrics import fraction_energy_assigned_correctly
from nilmtk import HDFDataStore
source = "/Users/nipunbatra/Copy/Dataset/iawe.h5"
train = DataSet(source)
test = DataSet(source)
train.set_window(start='2013-05-24 00:00:00', end='2013-08-21 00:00:00')
train_elec = train.buildings[1].elec
co = CombinatorialOptimisation()
co.train(train_elec)
test.set_window(start="14-07-2013 00:00:00", end="27-7-2013 00:00:00")
test_mains = test.buildings[1].elec.mains()

disagout = "/Users/nipunbatra/Desktop/out.h5"
output = HDFDataStore(disagout, 'w')

co.disaggregate(test_mains, output)
output.close()
disag = DataSet(disagout)
disag_elec = disag.buildings[1].elec
fr = disag_elec['fridge'].load().next()
fr.head()
In [49]: fr.head()
Out[49]: 
                           power
                          active
2013-07-14 00:00:00+05:30     84
2013-07-14 00:01:00+05:30    121
2013-07-14 00:02:00+05:30      0
2013-07-14 00:03:00+05:30    121
2013-07-14 00:04:00+05:30     84
test_elec = test.buildings[1].elec
fr_pr = test_elec['fridge'].load().next()
fr_pr.head()
physical_quantity              power                      
type                        apparent     active   reactive
2013-07-14 00:00:00+05:30  92.081001  78.424004  48.255001
2013-07-14 00:00:01+05:30  91.843002  78.287003  48.023998
2013-07-14 00:00:02+05:30  92.055000  78.383003  48.271999
2013-07-14 00:00:03+05:30  91.543999  78.146004  47.893002
2013-07-14 00:00:04+05:30  91.834999  78.124001  48.196999
from nilmtk.metrics import mean_normalized_error_power
mean_normalized_error_power(disag_elec, test_elec)
In [55]: mean_normalized_error_power(disag_elec, test_elec)
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-55-a2cf9d5e8e93> in <module>()
----> 1 mean_normalized_error_power(disag_elec, test_elec)

/Users/nipunbatra/git/nilmtk/nilmtk/metrics.pyc in mean_normalized_error_power(predictions, ground_truth)
    145             sum_of_ground_truth_power += aligned_meters_chunk.icol(1).sum()
    146 
--> 147         mne[pred_meter.instance()] = total_abs_diff / sum_of_ground_truth_power
    148 
    149     return pd.Series(mne)

ZeroDivisionError: float division by zero
In [64]: f = fraction_energy_assigned_correctly(disag_elec, test_elec)
10/10 ElecMeter(instance=12, building=1, dataset='iAWE', appliances=[Appliance(type='motor', instance=1)])ce=1)]))r', instance=1)])ce=1)]))
In [65]: f
Out[65]: nan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant