Uploaded image for project: 'Mahout'
  1. Mahout
  2. MAHOUT-1958

CityBlockSimilarity.itemSimilarities can overflow

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • 1.0.0
    • classic-15.0
    • classic
    • None

    Description

      The CityBlockSimilarity.itemSimilarities method has the following code:

      CityBlockSimilarity.java
            int preferring2 = dataModel.getNumUsersWithPreferenceFor(itemID2s[i]);
            int intersection = dataModel.getNumUsersWithPreferenceFor(itemID1, itemID2s[i]);
      

      Here, the two methods return long values, and can overflow. Indeed, LogLikelihoodSimilaritydoItemSimilarity once had the same problem. The fixed code is

      LogLikelihoodSimilaritydoItemSimilarity.java
          long preferring1 = dataModel.getNumUsersWithPreferenceFor(itemID1);
          long numUsers = dataModel.getNumUsers();
      

      Please refer to MAHOUT-738 for details.

      Attachments

        Activity

          People

            balakuntala Shashanka Balakuntala Srinivasa
            haozhong Hao Zhong
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: