示例#1
0
 public List<Recommendation_Meta_Item> GetRecommendationR4(Predict_DAO_MCol a, double param)
 {
     List<Recommendation_Meta_Item> list1 = new List<Recommendation_Meta_Item>();
     List<string> list2 = new List<string>();
     List<string> list3 = new List<string>();
     List<string> list4 = new List<string>();
     Dictionary<string, double> dictionary1 = new Dictionary<string, double>();
     Dictionary<string, double> dictionary2 = new Dictionary<string, double>();
     Dictionary<string, double> dictionary3 = new Dictionary<string, double>();
     Dictionary<string, double> dictionary4 = new Dictionary<string, double>();
     Dictionary<string, string> dictionary5 = new Dictionary<string, string>();
     List<string> listClusterId = a.GetListClusterID();
     Dictionary<string, string> listNewItem = a.GetListNewItem();
     foreach (string cluster in listClusterId)
     {
         try
         {
             Dictionary<string, double> listRateU = a.GetListRateU(cluster);
             Dictionary<string, double> listRateF = a.GetListRateF(cluster);
             foreach (KeyValuePair<string, double> keyValuePair1 in listRateU)
             {
                 Dictionary<string, double> listRateUf = a.GetListRateUF(keyValuePair1.Key);
                 double num1 = 0.0;
                 string FamillyCode = "Not found";
                 List<string> list5 = new List<string>();
                 List<double> list6 = new List<double>();
                 foreach (KeyValuePair<string, double> keyValuePair2 in listRateF)
                 {
                     double num2;
                     if (listRateUf.ContainsKey(keyValuePair2.Key))
                     {
                         double num3 = keyValuePair2.Value;
                         double num4 = keyValuePair1.Value;
                         double num5 = keyValuePair2.Value;
                         num2 = param * num5 * (1.0 / num4 - 1.0 / num3);
                     }
                     else
                         num2 = 0.0;
                     if (num2 > num1)
                     {
                         num1 = num2;
                         FamillyCode = keyValuePair2.Key;
                     }
                 }
                 if (num1 != 0.0)
                 {
                     double num2 = (double)a.getQTYR4(keyValuePair1.Key, FamillyCode, 1);
                     foreach (KeyValuePair<string, string> keyValuePair2 in listNewItem)
                     {
                         if (keyValuePair2.Value.Equals(FamillyCode))
                             list1.Add(new Recommendation_Meta_Item()
                             {
                                 UserID = keyValuePair1.Key,
                                 RecommendType = ConstantValues.RC_TYPE_LRS04,
                                 MetaItemID = keyValuePair2.Key,
                                 Quantity = num2,
                                 Score = num1
                             });
                     }
                 }
             }
         }
         catch (Exception ex)
         {
         }
     }
     return list1;
 }