Esempio n. 1
0
        //---------------------------------------------------------------------------------------------
        //This function call GetQualtityTraditionalUser to compute the quantity for each recommendations in the list
        //---------------------------------------------------------------------------------------------
        public List <Recommendation_Meta_Item> GetQuantityTraditionalUsers(Predict_DAO_MCol a, List <Recommendation_Meta_Item> list, Dictionary <string, double> UCA)
        {
            Int32  QTY;
            double M = 1;

            if (UCA.ContainsKey("MEANS_VALUE"))
            {
                M = UCA["MEANS_VALUE"];
            }

            for (int i = 0; i < list.Count; i++)
            {
                QTY = a.GetQualtityTraditionalUser(list[i]);
                if (QTY > 0)
                {
                    list[i].Quantity = QTY;
                }
                else
                {
                    list[i].Quantity = 1;
                }

                if (UCA.ContainsKey(list[i].UserID))
                {
                    list[i].Quantity = (int)list[i].Quantity * (UCA[list[i].UserID] / M);
                }
            }

            return(list);
        }
Esempio n. 2
0
 public List <Recommendation_Meta_Item> GetQuantityTraditionalUsers(Predict_DAO_MCol a, List <Recommendation_Meta_Item> list)
 {
     for (int index = 0; index < list.Count; ++index)
     {
         double qualtityTraditionalUser = a.GetQualtityTraditionalUser(list[index]);
         list[index].Quantity = qualtityTraditionalUser == 0.0 ? 1.0 : (double)(int)qualtityTraditionalUser;
     }
     return(list);
 }
Esempio n. 3
0
 public List <Recommendation_Meta_Item> GetQuantityTraditionalUsersR3(Predict_DAO_MCol a, List <Recommendation_Meta_Item> list)
 {
     for (int index = 0; index < list.Count; ++index)
     {
         double qualtityTraditionalUser = a.GetQualtityTraditionalUser(list[index]);
         if (qualtityTraditionalUser != 0.0)
         {
             list[index].Quantity = (double)((int)(list[index].Quantity + qualtityTraditionalUser) / 2);
         }
     }
     return(list);
 }
Esempio n. 4
0
        public List <Recommendation_Meta_Item> GetQuantityTraditionalUsersR3(Predict_DAO_MCol a, List <Recommendation_Meta_Item> list, Dictionary <string, double> UCA)
        {
            double QTY;
            double M = 1;

            if (UCA.ContainsKey("MEANS_VALUE"))
            {
                M = UCA["MEANS_VALUE"];
            }

            for (int i = 0; i < list.Count; i++)
            {
                QTY = a.GetQualtityTraditionalUser(list[i]);
                if (QTY != 0)
                {
                    list[i].Quantity = (int)(list[i].Quantity + QTY) / 2;
                }
                //----------------------------------------
                if (UCA.ContainsKey(list[i].UserID))
                {
                    list[i].Quantity = (int)list[i].Quantity * (UCA[list[i].UserID] / M);
                }
            }



            //--------------------
            //a.commitTransaction();
            return(list);
            //}
            //catch (Exception ex)
            //{
            //    a.rollbackTransaction();
            //    throw ex;
            //}
        }