-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Hi,
I just find to use TFX to extract the defined features from my Twitter dataset. So I populated the user_label_assignments table with my labeled users (not all users are labeled of course since I want to use this software to label them). I also defined the label in conf.json file as label: {individual: 1, organization: 2}. Then I ran the TFX using the following command:
$ tfx ~/conf.json ~/path/to/tweet_dir
But I keep receiving the following error which I think is related to a bug in the code:
Traceback (most recent call last):
File "/usr/local/bin/tfx", line 63, in
extractor.FeatureExtractor(conf, args.tweet_dir)
File "/usr/local/lib/python2.7/dist-packages/tfx/extractor.py", line 25, in init
user_set = users.UserSet(conf, tweet_dir)
File "/usr/local/lib/python2.7/dist-packages/tfx/users.py", line 76, in init
self.user_ids[label] = self.connection.get_users_for_label(label_id)
File "/usr/local/lib/python2.7/dist-packages/tfx/database.py", line 226, in get_users_for_label
return self.profiles[label]
KeyError: 2
I think the problem arises from the fact that in ~/tfx/database.py, the __init__ method of the JSONFile class, assigns all users to label 0. I mean here:
label = 0
if label not in self.profiles:
self.profiles[label] = {}
if user_id not in self.profiles[label]:
self.tweets[user_id] = []
self.profiles[label][user_id] = tweet_json['user']
so it raises an error when the get_users_for_label method get called, since get_users_for_label looks for 1 and 2 as keys, but self.profiles only contains 0 as its key.