public MalPositiveFeedbackRecResults GetRecommendations(MalPositiveFeedbackInput inputForUser, int numRecommendationsToTryToGet) { IUserInputClassifier <MalUserListEntries> classifier; decimal targetScoreUsed; if (inputForUser.TargetFraction != null) { classifier = new MalPercentageRatingClassifier(inputForUser.TargetFraction.Value, m_minEpisodesToClassifyIncomplete); } else { classifier = new MalMinimumScoreRatingClassifier(inputForUser.TargetScore.Value, m_minEpisodesToClassifyIncomplete); } IPositiveFeedbackForUser basicFeedback = inputForUser.AnimeList.AsPositiveFeedback(classifier, additionalOkToRecommendPredicate: (animeId) => m_userCountByAnime.ContainsKey(animeId) && m_userCountByAnime[animeId] >= m_minUsersToCountAnime); if (inputForUser.TargetFraction != null) { targetScoreUsed = basicFeedback.Items.Min(itemId => inputForUser.AnimeList.Entries[itemId].Rating ?? 10); } else { targetScoreUsed = inputForUser.TargetScore.Value; } IEnumerable <RatingPredictionRecommendation> recs = m_recommender.GetRecommendations(basicFeedback, numRecommendationsToTryToGet); return(new MalPositiveFeedbackRecResults(recs, targetScoreUsed)); }
public MalPositiveFeedbackRecResults GetRecommendations(MalUserListEntries inputForUser, int numRecommendationsToTryToGet) { MalPositiveFeedbackInput input = new MalPositiveFeedbackInput(inputForUser, targetFraction: m_targetFraction); return(m_underlyingRecSource.GetRecommendations(input, numRecommendationsToTryToGet)); }