{"action":"created","issue":{"url":"https://api.github.com/repos/nilmtk/nilmtk/issues/371","labels_url":"https://api.github.com/repos/nilmtk/nilmtk/issues/371/labels{/name}","comments_url":"https://api.github.com/repos/nilmtk/nilmtk/issues/371/comments","events_url":"https://api.github.com/repos/nilmtk/nilmtk/issues/371/events","html_url":"https://github.com/nilmtk/nilmtk/issues/371","id":65163325,"number":371,"title":"F1_score problem","user":{"login":"skoczmanx","id":11716528,"avatar_url":"https://avatars.githubusercontent.com/u/11716528?v=3","gravatar_id":"","url":"https://api.github.com/users/skoczmanx","html_url":"https://github.com/skoczmanx","followers_url":"https://api.github.com/users/skoczmanx/followers","following_url":"https://api.github.com/users/skoczmanx/following{/other_user}","gists_url":"https://api.github.com/users/skoczmanx/gists{/gist_id}","starred_url":"https://api.github.com/users/skoczmanx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoczmanx/subscriptions","organizations_url":"https://api.github.com/users/skoczmanx/orgs","repos_url":"https://api.github.com/users/skoczmanx/repos","events_url":"https://api.github.com/users/skoczmanx/events{/privacy}","received_events_url":"https://api.github.com/users/skoczmanx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-03-30T08:46:48Z","updated_at":"2015-04-03T05:49:43Z","closed_at":null,"body":"Hello, \r\nafter run this code, I have ValueError: Shape of passed values is (2, 0), indices imply (2, 1263).\r\n Can you take a look and tell what I'm doing wrong ? \r\n\r\n```python\r\nfrom nilmtk.disaggregate import CombinatorialOptimisation, FHMM\r\nfrom nilmtk import DataSet, HDFDataStore\r\nfrom nilmtk.utils import print_dict\r\nfrom nilmtk.metrics import f1_score\r\nimport matplotlib.pyplot as plt\r\nimport os\r\n\r\nclass CoDisag:\r\n    def __init__(self,train_elec, test_elec, output = None):\r\n        self.train_elec = train_elec #elec.select_top_k(first_top_num)\r\n        self.test_elec = test_elec #elec.mains()\r\n        if output is None:\r\n            self.output = 'out'\r\n        else:\r\n            self.output = output\r\n\r\n    def train(self):\r\n        self.co = CombinatorialOptimisation()\r\n        #self.co = FHMM()\r\n        self.co.train(self.train_elec)\r\n\r\n    def disag(self, appliance2compare):\r\n        self.output_file = os.path.join(self.output, 'iawe_disag_' + appliance2compare +  '.h5')\r\n        print self.output_file\r\n        output = HDFDataStore(self.output_file, 'w')\r\n        self.co.disaggregate(self.test_elec, output)\r\n        output.store.keys()\r\n        output.close()\r\n        self.appliance2compare = appliance2compare\r\n\r\n    def getDisagApplianceActiveEnergy(self):\r\n        disag = DataSet(self.output_file)\r\n\r\n        disag_elec = disag.buildings[1].elec\r\n        f1 = f1_score(disag_elec, self.train_elec)\r\n        f1.index = disag_elec.get_labels(f1.index)\r\n        f1.plot(kind='barh', figsize=(10,6))\r\n        plt.ylabel('appliance');\r\n        plt.xlabel('f-score');\r\n\r\n        disag.store.close()\r\n        return disag_elec[self.appliance2compare].total_energy().to_dict()['active']\r\n\r\n\r\nfirst_top_num = 10\r\nappliance2compare = 'television'\r\n\r\ntrain_set = DataSet('data/iawe.h5')\r\ntrain_set.set_window(start=None, end='2013-08-05')\r\ntrain_elec = train_set.buildings[1].elec\r\n\r\ntest_set = DataSet('data/iawe.h5')\r\ntest_set.set_window(start='2013-08-05', end=None)\r\ntest_elec = test_set.buildings[1].elec\r\ntest_elec_mains = test_elec.mains()\r\n\r\ncoDisag = CoDisag(train_elec, test_elec_mains, 'out')\r\ncoDisag.train()\r\ncoDisag.disag(appliance2compare)\r\n\r\ndisagEnergy = coDisag.getDisagApplianceActiveEnergy()\r\n```\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"D:/Bil/AKA/NilMtkTest/CoDisag.py\", line 65, in <module>\r\n    disagEnergy = coDisag.getDisagApplianceActiveEnergy()\r\n  File \"D:/Bil/AKA/NilMtkTest/CoDisag.py\", line 38, in getDisagApplianceActiveEnergy\r\n    f1 = f1_score(disag_elec, self.train_elec)\r\n  File \"c:\\nilmtk-master\\nilmtk\\metrics.py\", line 222, in f1_score\r\n    'when_on'):\r\n  File \"c:\\nilmtk-master\\nilmtk\\electric.py\", line 799, in align_two_meters\r\n    yield pd.DataFrame({'master': master_chunk, 'slave': slave_chunk})\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\frame.py\", line 208, in __init__\r\n    mgr = self._init_dict(data, index, columns, dtype=dtype)\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\frame.py\", line 336, in _init_dict\r\n    dtype=dtype)\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\frame.py\", line 4627, in _arrays_to_mgr\r\n    return create_block_manager_from_arrays(arrays, arr_names, axes)\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\internals.py\", line 3544, in create_block_manager_from_arrays\r\n    construction_error(len(arrays), arrays[0].shape, axes, e)\r\n  File \"C:\\Anaconda\\lib\\site-packages\\pandas\\core\\internals.py\", line 3513, in construction_error\r\n    raise e\r\nValueError: Shape of passed values is (2, 0), indices imply (2, 1263)\r\nClosing remaining open files:data/iawe.h5...donedata/iawe.h5...doneout\\iawe_disag_television.h5...done\r\n```"},"comment":{"url":"https://api.github.com/repos/nilmtk/nilmtk/issues/comments/89174673","html_url":"https://github.com/nilmtk/nilmtk/issues/371#issuecomment-89174673","issue_url":"https://api.github.com/repos/nilmtk/nilmtk/issues/371","id":89174673,"user":{"login":"skoczmanx","id":11716528,"avatar_url":"https://avatars.githubusercontent.com/u/11716528?v=3","gravatar_id":"","url":"https://api.github.com/users/skoczmanx","html_url":"https://github.com/skoczmanx","followers_url":"https://api.github.com/users/skoczmanx/followers","following_url":"https://api.github.com/users/skoczmanx/following{/other_user}","gists_url":"https://api.github.com/users/skoczmanx/gists{/gist_id}","starred_url":"https://api.github.com/users/skoczmanx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoczmanx/subscriptions","organizations_url":"https://api.github.com/users/skoczmanx/orgs","repos_url":"https://api.github.com/users/skoczmanx/repos","events_url":"https://api.github.com/users/skoczmanx/events{/privacy}","received_events_url":"https://api.github.com/users/skoczmanx/received_events","type":"User","site_admin":false},"created_at":"2015-04-03T05:49:43Z","updated_at":"2015-04-03T05:49:43Z","body":"Thank you very much"}}