nilmtk-contrib icon indicating copy to clipboard operation
nilmtk-contrib copied to clipboard

AttributeError in WindowGRU

Open klemenjak opened this issue 4 years ago • 4 comments

Hi,

I was wondering if you are familiar with the following error in Window GRU:

Finished training for  WindowGRU
Joint Testing for all algorithmsDropping missing values
Generating predictions for : WindowGRU
Traceback (most recent call last):
  File "simple_disag.py", line 407, in <module>
    api_results_f1 = API(experiment_f1)
  File "/home/chklemen/anaconda3/envs/thesis/lib/python3.6/site-packages/nilmtk/api.py", line 65, in __init__
    self.experiment(params)
  File "/home/chklemen/anaconda3/envs/thesis/lib/python3.6/site-packages/nilmtk/api.py", line 123, in experiment
    self.test_jointly(d)
  File "/home/chklemen/anaconda3/envs/thesis/lib/python3.6/site-packages/nilmtk/api.py", line 374, in test_jointly
    self.call_predict(self.classifiers)
  File "/home/chklemen/anaconda3/envs/thesis/lib/python3.6/site-packages/nilmtk/api.py", line 420, in call_predict
    'Europe/London')
  File "/home/chklemen/anaconda3/envs/thesis/lib/python3.6/site-packages/nilmtk/api.py", line 468, in predict
    pred_list = clf.disaggregate_chunk(test_elec)
  File "/home/chklemen/anaconda3/envs/thesis/lib/python3.6/site-packages/nilmtk_contrib/disaggregate/WindowGRU.py", line 147, in disaggregate_chunk
    mains = mains.values.reshape((-1,self.sequence_length,1))
AttributeError: 'numpy.ndarray' object has no attribute 'values'
Closing remaining open files:../../data/SynD.h5...done../../data/SynD.h5...done

Sometimes I get this error for test chunks that work fine for RNN or DAE.

Any idea?

best, C

klemenjak avatar Aug 25 '20 13:08 klemenjak

At this point, test_main_list should be a list of dataframes:

https://github.com/nilmtk/nilmtk-contrib/blob/de38dabf8c461ae01b9800546e5e147e44f3de18/nilmtk_contrib/disaggregate/WindowGRU.py#L76-L88

Looks like there's a missing conversion somewhere.

Note that the line numbers don't match (from the traceback, yours is at 147 while the version on master starts at 76), so you could be using a different version.

PMeira avatar Aug 25 '20 13:08 PMeira

Indeed. Thanks for pointing this out! I will investigate…

best, C

Am 25.08.2020 um 15:57 schrieb Paulo Meira [email protected]:

At this point, test_main_list should be a list of dataframes:

https://github.com/nilmtk/nilmtk-contrib/blob/de38dabf8c461ae01b9800546e5e147e44f3de18/nilmtk_contrib/disaggregate/WindowGRU.py#L76-L88 https://github.com/nilmtk/nilmtk-contrib/blob/de38dabf8c461ae01b9800546e5e147e44f3de18/nilmtk_contrib/disaggregate/WindowGRU.py#L76-L88 Looks like there's a missing conversion somewhere.

Note that the line numbers don't match (from the traceback, yours is at 147 while the version on master starts at 76), so you could be using a different version.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nilmtk/nilmtk-contrib/issues/31#issuecomment-680041699, or unsubscribe https://github.com/notifications/unsubscribe-auth/AINC6EYSG2BKVTLBHON3ORTSCO7ODANCNFSM4QKUZ6JQ.

klemenjak avatar Aug 25 '20 14:08 klemenjak

I checked my files. I added callbacks to partial fit some time ago, which explain why the line numbers don't match. Apart from that, the source files match. I remember having had this issue on several datasets with GRU and I don't quite understand why.

klemenjak avatar Aug 26 '20 08:08 klemenjak

Hm... would you be able to share an example with any of the common datasets?

We need either something missing the conversion to dataframes or mutating the list, which I also couldn't find by inspection.

PMeira avatar Aug 26 '20 13:08 PMeira