//possible that null will be returned from this function if no a like users found public static List <int> defineUserSegmentsTransitionsProbabilitiesOption1(string _userId, int _age, string _gender, float userDataWeight) { SleepSegmentsStatsRepository repo = new SleepSegmentsStatsRepository(); List <int> userStats = repo.GetUserSleepSegmentsStatsList(_userId); List <int> aLikeUsersAverages = repo.getSleepSegmentsStatsAveragesFromALikeUsersOption1(_userId, _age, _gender); if (aLikeUsersAverages == null) { return(null); } List <int> res = new List <int>(); float aLikeUsersDataWeight = 1 - userDataWeight; for (int i = 0; i < userStats.Count; i++) { res.Add((int)(userDataWeight * userStats[i]) + (int)(aLikeUsersDataWeight * aLikeUsersAverages[i])); } return(res); }
//possible that null will be returned from this function if no a like users found public static List <int> getSleepSegmentsStatsAverages(string _userId, int _age, string _gender) { SleepSegmentsStatsRepository repo = new SleepSegmentsStatsRepository(); return(repo.getSleepSegmentsStatsAveragesFromALikeUsersOption1(_userId, _age, _gender)); }