From c50f3cb6fce29fe15f8e5cdfe400844a7483bbf3 Mon Sep 17 00:00:00 2001 From: Athanasios Xygkis <athanasios.xygkis@epfl.ch> Date: Mon, 22 Feb 2021 15:04:07 +0000 Subject: [PATCH] Json --- README.md | 2 +- src/main/scala/predict/Predictor.scala | 33 ++++++++++++++++++++-- src/main/scala/recommend/Recommender.scala | 19 ++++++++----- src/main/scala/stats/Analyzer.scala | 28 ++++++++++++++++-- 4 files changed, 68 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index aa1b7d9..51ce785 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Should be available by default on the IC Cluster. Otherwise, refer to each proje Download the ````ml-100k.zip```` dataset in the ````data/```` folder: ```` -> mkdir data +> mkdir -p data > cd data > wget http://files.grouplens.org/datasets/movielens/ml-100k.zip ```` diff --git a/src/main/scala/predict/Predictor.scala b/src/main/scala/predict/Predictor.scala index d9b871a..013030a 100644 --- a/src/main/scala/predict/Predictor.scala +++ b/src/main/scala/predict/Predictor.scala @@ -65,9 +65,36 @@ object Predictor extends App { // Limiting the scope of implicit formats with {} implicit val formats = org.json4s.DefaultFormats val answers: Map[String, Any] = Map( - "3.1.4" -> Map( - "global-mae" -> globalMae - ) + "Q3.1.4" -> Map( + "MaeGlobalMethod" -> 0.0, // Datatype of answer: Double + "MaePerUserMethod" -> 0.0, // Datatype of answer: Double + "MaePerItemMethod" -> 0.0, // Datatype of answer: Double + "MaeBaselineMethod" -> 0.0 // Datatype of answer: Double + ), + + "Q3.1.5" -> Map( + "DurationInMicrosecForGlobalMethod" -> Map( + "min" -> 0.0, // Datatype of answer: Double + "max" -> 0.0, // Datatype of answer: Double + "average" -> 0.0 // Datatype of answer: Double + ), + "DurationInMicrosecForPerUserMethod" -> Map( + "min" -> 0.0, // Datatype of answer: Double + "max" -> 0.0, // Datatype of answer: Double + "average" -> 0.0 // Datatype of answer: Double + ), + "DurationInMicrosecForPerItemMethod" -> Map( + "min" -> 0.0, // Datatype of answer: Double + "max" -> 0.0, // Datatype of answer: Double + "average" -> 0.0 // Datatype of answer: Double + ), + "DurationInMicrosecForBaselineMethod" -> Map( + "min" -> 0.0, // Datatype of answer: Double + "max" -> 0.0, // Datatype of answer: Double + "average" -> 0.0 // Datatype of answer: Double + ), + "RatioBetweenBaselineMethodAndGlobalMethod" -> 0.0 // Datatype of answer: Double + ), ) json = Serialization.writePretty(answers) } diff --git a/src/main/scala/recommend/Recommender.scala b/src/main/scala/recommend/Recommender.scala index 2746154..6e14620 100644 --- a/src/main/scala/recommend/Recommender.scala +++ b/src/main/scala/recommend/Recommender.scala @@ -61,13 +61,18 @@ object Recommender extends App { // Limiting the scope of implicit formats with {} implicit val formats = org.json4s.DefaultFormats val answers: Map[String, Any] = Map( - "4.1.1" -> List[Any]( - List(0,"Tron", 5.0), - List(0,"Tron", 5.0), - List(0,"Tron", 5.0), - List(0,"Tron", 5.0), - List(0,"Tron", 5.0) - ) + + // IMPORTANT: To break ties and ensure reproducibility of results, + // please report the top-5 recommendations that have the smallest + // movie identifier. + + "Q4.1.1" -> List[Any]( + List(254, "Batman & Robin (1997)", 5.0), // Datatypes for answer: Int, String, Double + List(338, "Bean (1997)", 5.0), + List(615, "39 Steps", 5.0), + List(741, "Last Supper", 5.0), + List(587, "Hour of the Pig", 5.0) + ) ) json = Serialization.writePretty(answers) } diff --git a/src/main/scala/stats/Analyzer.scala b/src/main/scala/stats/Analyzer.scala index 35076d5..97a9ee9 100644 --- a/src/main/scala/stats/Analyzer.scala +++ b/src/main/scala/stats/Analyzer.scala @@ -53,9 +53,31 @@ object Analyzer extends App { // Limiting the scope of implicit formats with {} implicit val formats = org.json4s.DefaultFormats val answers: Map[String, Any] = Map( - "3.1.1" -> Map( - "global-avg-rating" -> 3.0 - ) + "Q3.1.1" -> Map( + "GlobalAverageRating" -> 0.0 // Datatype of answer: Double + ), + "Q3.1.2" -> Map( + "UsersAverageRating" -> Map( + // Using as your input data the average rating for each user, + // report the min, max and average of the input data. + "min" -> 0.0, // Datatype of answer: Double + "max" -> 0.0, // Datatype of answer: Double + "average" -> 0.0 // Datatype of answer: Double + ), + "AllUsersCloseToGlobalAverageRating" -> true, // Datatype of answer: Boolean + "RatioUsersCloseToGlobalAverageRating" -> 0.0 // Datatype of answer: Double + ), + "Q3.1.3" -> Map( + "ItemsAverageRating" -> Map( + // Using as your input data the average rating for each item, + // report the min, max and average of the input data. + "min" -> 0.0, // Datatype of answer: Double + "max" -> 0.0, // Datatype of answer: Double + "average" -> 0.0 // Datatype of answer: Double + ), + "AllItemsCloseToGlobalAverageRating" -> true, // Datatype of answer: Boolean + "RatioItemsCloseToGlobalAverageRating" -> 0.0 // Datatype of answer: Double + ), ) json = Serialization.writePretty(answers) } -- GitLab