예제 #1
0
        public void TrainBaseModel(int cFeatures)
        {
            double avg = (_train.SumRanks() + _test.SumRanks()) / (_train.NumOfRanks() + _test.NumOfRanks());
            var    svd = new SVD(avg, cFeatures);

            RankingDB train      = new RankingDB();
            RankingDB validation = new RankingDB();

            DivideDB(_train, 0.95, train, validation);

            var    ranks = train.GetAllData();
            double RMSE = double.MaxValue; double LastRMSE = double.MaxValue;

            while (RMSE <= LastRMSE)
            {
                LastRMSE = RMSE;
                svd.Train(ranks);
                _trainEngine.setSVD(svd);
                RMSE = ComputeRMSE(PredictionMethod.SVD, _trainEngine, validation.GetAllData());
            }
            //_engine.setSVD(svd);
        }
 public void setSVD(SVD svd)
 {
     _svd = svd;
 }