Beispiel #1
0
        public string EvaluateGlobalAverage()
        {
            var recommenderGA = new MyMediaLite.RatingPrediction.GlobalAverage();

            recommenderGA.Ratings = mydata;
            recommenderGA.Train();

            return(recommenderGA.DoCrossValidation().ToString());
        }
        //*********** GlobalAverage Recommender
        public List <int> getBestItemsGlobalAverage(string dataset, int userid, int recs)
        {
            var mydata = RatingData.Read(dataset);
            //Create the recommender
            var recommenderGlobalAverage = new MyMediaLite.RatingPrediction.GlobalAverage();

            //Give it the dataset
            recommenderGlobalAverage.Ratings = mydata;
            //Train it
            recommenderGlobalAverage.Train();
            /////////////

            // Make the predictions
            var user_recs = recommenderGlobalAverage.Recommend(userid, recs);

            // get the recommendations
            foreach (var i in user_recs)
            {
                mylist.Add(i.Item1);
            }

            return(mylist);
        }