Originally, user, item, and contextual features were initialized with a dummy element np.array([0.]) to avoid errors associated with empty array manipulation. This workaround added unnecessary dimensions to the input vectors and caused a failure in a simple case like:
recommender = FMRecommender(p=3)
recommender.initialize()
user = User(0) # -> dummy user feature: np.array([0.])
recommender.register(user)
item = Item(0) # -> dummy item feature: np.array([0.])
recommender.register(item)
# Eventually, the num of dimensions of a feature vector corresponding
# to the event is # 5 (1 user dummy + 1 item dummy + 3 contextual),
# which differs from `p=3`.
event = Event(user, item, context=np.array([0, 4, 0]))
recommender.update(event) # -> FAILED
Originally, user, item, and contextual features were initialized with a dummy element
np.array([0.])
to avoid errors associated with empty array manipulation. This workaround added unnecessary dimensions to the input vectors and caused a failure in a simple case like:Fix #10