Example #1
0
        protected virtual float doEstimatePreference(long userID, PreferenceArray preferencesFromUser, long itemID)
        {
            double num  = 0.0;
            double num2 = 0.0;
            int    num3 = 0;

            double[] numArray = this.similarity.itemSimilarities(itemID, preferencesFromUser.getIDs());
            for (int i = 0; i < numArray.Length; i++)
            {
                double d = numArray[i];
                if (!double.IsNaN(d))
                {
                    num  += d * preferencesFromUser.getValue(i);
                    num2 += d;
                    num3++;
                }
            }
            if (num3 <= 1)
            {
                return(float.NaN);
            }
            float estimate = (float)(num / num2);

            if (this.capper != null)
            {
                estimate = this.capper.capEstimate(estimate);
            }
            return(estimate);
        }
Example #2
0
        protected override float doEstimatePreference(long userID, PreferenceArray preferencesFromUser, long itemID)
        {
            double[] numArray = base.getSimilarity().itemSimilarities(itemID, preferencesFromUser.getIDs());
            bool     flag     = false;
            double   num      = 0.0;

            foreach (double num2 in numArray)
            {
                if (!double.IsNaN(num2))
                {
                    flag = true;
                    num += num2;
                }
            }
            return(flag ? ((float)num) : float.NaN);
        }
Example #3
0
 public FastIDSet getCandidateItems(long userID, PreferenceArray preferencesFromUser, DataModel dataModel)
 {
     return(this.doGetCandidateItems(preferencesFromUser.getIDs(), dataModel));
 }