@Test public void testAllRecommenderSystemsFilePersistence() throws CannotLoadRatingsDataset, CannotLoadContentDataset { final List<RecommenderSystem> recommenderSystems = RecommenderSystemsFactory.getInstance().getAllClasses(RecommenderSystem.class); for (RecommenderSystem recommenderSystem : recommenderSystems) { if (recommenderSystem instanceof Recommender_DatasetProperties) { continue; } String configFile = TEST_DIRECTORY + recommenderSystem.getName() + "_config.xml"; RecommenderSystemConfigurationFileParser.saveConfigFile( configFile, recommenderSystem, datasetLoader, new FilePersistence(recommenderSystem.getName(), "dat", new File(TEST_DIRECTORY)), new OnlyNewItems(), getRecommendationOutputFileXML(recommenderSystem)); Chronometer chronometer = new Chronometer(); SingleUserRecommendation.buildRecommendationModel(configFile); Global.showln( "Built model of '" + recommenderSystem + "' in " + chronometer.printTotalElapsed()); RatingsDataset<? extends Rating> ratingsDataset = datasetLoader.getRatingsDataset(); chronometer.reset(); ratingsDataset .allUsers() .stream() .forEach( (idUser) -> { SingleUserRecommendation.recommendToUser(configFile, idUser); }); Global.showln( "Recommended with '" + recommenderSystem + "' to " + datasetLoader.getRatingsDataset().allUsers().size() + " users in " + chronometer.printTotalElapsed()); } }
/** Test of datasetDiff method, of class RatingsDatasetDiff. */ @Test public void testDatasetDiff() { RatingsDataset<? extends Rating> oldRatingsDataset = RandomRatingsDatasetFactory.createRatingsDatasetWithLoadFactor( 10, 20, 0.5, new DecimalDomain(1, 5), 654321); RatingsDataset<? extends Rating> newRatingsDataset = RandomRatingsDatasetFactory.createRatingsDatasetWithLoadFactor( 10, 20, 0.5, new DecimalDomain(1, 5), 123456); Global.showln("============================================================="); Global.showln("===================== Old dataset ==========================="); Global.showln("============================================================="); Global.showln(DatasetPrinter.printCompactRatingTable(oldRatingsDataset)); Global.showln("============================================================="); Global.showln("===================== New dataset ==========================="); Global.showln("============================================================="); Global.showln(DatasetPrinter.printCompactRatingTable(newRatingsDataset)); Global.showln("============================================================="); Global.showln("===================== Diff old to new ======================="); Global.showln("============================================================="); Global.showln(RatingsDatasetDiff.printDiff(oldRatingsDataset, newRatingsDataset)); Global.showln("============================================================="); Global.showln("===================== Diff new to old ======================="); Global.showln("============================================================="); Global.showln(RatingsDatasetDiff.printDiff(newRatingsDataset, oldRatingsDataset)); Global.showln("============================================================="); Global.showln("===================== Diff histogram old to new ============="); Global.showln("============================================================="); Global.showln(RatingsDatasetDiff.printDiffHistogram(newRatingsDataset, oldRatingsDataset)); Global.showln("============================================================="); Global.showln("===================== Diff histogram new to old ============="); Global.showln("============================================================="); Global.showln(RatingsDatasetDiff.printDiffHistogram(oldRatingsDataset, newRatingsDataset)); }