public TSvdBoostedKnnModel TrainKnnModel(TSvdBoostedKnnModel model, List <IUser> trainUsers)
        {
            foreach (var user in trainUsers)
            {
                model.Users.Add(SvdBoostedKnnUser.FromIUser(user, NewUserFeatureGenerator.GetNewUserFeatures(model, user)));
            }

            return(model);
        }
        public IEnumerable <IRecommendation> GenerateRecommendations(IUser user, TSvdBoostedKnnModel model, List <IArtist> artists, int nearestNeighboursCount)
        {
            var svdBoostedKnnUser = SvdBoostedKnnUser.FromIUser(user, NewUserFeatureGenerator.GetNewUserFeatures(model, user));
            var neighbours        = CalculateKNearestNeighbours(svdBoostedKnnUser, model.Users, nearestNeighboursCount);

            if (neighbours.Count == 0)
            {
                return(null);
            }

            return(RecommendationGenerator.GenerateRecommendations(svdBoostedKnnUser, neighbours, model, artists));
        }
        public float PredictRatingForArtist(IUser user, TSvdBoostedKnnModel model, List <IArtist> artists, int artistIndex, int nearestNeighboursCount)
        {
            var svdBoostedKnnUser = SvdBoostedKnnUser.FromIUser(user, NewUserFeatureGenerator.GetNewUserFeatures(model, user));
            var neighbours        = CalculateKNearestNeighbours(svdBoostedKnnUser, model.Users, nearestNeighboursCount);

            if (neighbours.Count == 0)
            {
                return(1.0f);
            }

            return(RecommendationGenerator.PredictRatingForArtist(svdBoostedKnnUser, neighbours, model, artists, artistIndex));
        }