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

Disallow to build fature-based recommender from empty vector #12

Merged
merged 3 commits into from
Jan 20, 2022
Merged

Commits on Jan 19, 2022

  1. Configuration menu
    Copy the full SHA
    ec03ba7 View commit details
    Browse the repository at this point in the history
  2. Disallow to build feature-based recommender from empty vector

    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 unneccessary 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)
    takuti committed Jan 19, 2022
    Configuration menu
    Copy the full SHA
    d2dfc81 View commit details
    Browse the repository at this point in the history
  3. Allow empty context for feature-based recommender

    Recommender should be functional as long as either user, item, or
    contextual features is non-empty.
    takuti committed Jan 19, 2022
    Configuration menu
    Copy the full SHA
    52c1880 View commit details
    Browse the repository at this point in the history