Sorry, there are no recommendations for you.
"); + System.exit(1); + } + System.out.println("Rank | Movie Title |
---|---|
" + + (i + 1) + + " | " + + MovieDatabase.getTitle(movies.get(i).getItem()) + + " |
When users first visit the recommender website, our code will call the method
+ * getItemsToRate()
to get a list of movies to display on the web page for users to rate.
+ *
+ *
When a user submits their ratings, our code will call the method
+ * printRecommendationsFor
to get your recommendations based on the user's ratings. The ID
+ * given to this method is for a new Rater that we have already added to the RaterDatabase with
+ * ratings for the movies returned by the first method. Whatever is printed from that method will be
+ * displayed on the web page: HTML, plain text, or debugging information.
+ */
+public interface Recommender {
+ /**
+ * This method returns a list of movie IDs that will be used to look up the movies in the
+ * MovieDatabase and present them to users to rate.
+ *
+ *
The movies returned in the list will be displayed on a web page, so the number you choose + * may affect how long the page takes to load and how willing users are to rate the movies. For + * example, 10-20 should be fine, 50 or more would be too many. + * + *
There are no restrictions on the method you use to generate this list of movies: the most + * recent movies, movies from a specific genre, randomly chosen movies, or simply your favorite + * movies. + * + *
The ratings for these movies will make the profile for a new Rater that will be used to
+ * compare to for finding recommendations.
+ */
+ ArrayList The HTML printed will be displayed on a web page, so the number you choose to display may
+ * affect how long the page takes to load. For example, you may want to limit the number printed
+ * to only the top 20-50 movies recommended or to movies not rater by the given rater.
+ *
+ * You may also include CSS styling for your table using the <style> tag before you print
+ * the table. There are no restrictions on which movies you print, what order you print them in,
+ * or what information you include about each movie.
+ *
+ * @param webRaterID the ID of a new Rater that has been already added to the RaterDatabase with
+ * ratings for the movies returned by the method getItemsToRate
+ */
+ void printRecommendationsFor(String webRaterID);
+}
diff --git a/Week4/src/TrueFilter.java b/Week4/src/TrueFilter.java
new file mode 100644
index 0000000..9a5ae07
--- /dev/null
+++ b/Week4/src/TrueFilter.java
@@ -0,0 +1,6 @@
+public class TrueFilter implements Filter {
+ @Override
+ public boolean satisfies(String id) {
+ return true;
+ }
+}
diff --git a/Week4/src/Week4.java b/Week4/src/Week4.java
new file mode 100644
index 0000000..e85208a
--- /dev/null
+++ b/Week4/src/Week4.java
@@ -0,0 +1,36 @@
+/** @author Stanislav Rakitov */
+public class Week4 {
+ public static void main(String[] args) {
+ FourthRatings fourthRatings = new FourthRatings();
+ Rater meRater = new EfficientRater("15");
+ Rater otherRater = new EfficientRater("20");
+
+ meRater.addRating("2354", 10.0);
+ meRater.addRating("3285", 6.0);
+ meRater.addRating("1297", 2.0);
+ meRater.addRating("5804", 8.0);
+
+ otherRater.addRating("3285", 4.0);
+ otherRater.addRating("1297", 7.0);
+ otherRater.addRating("6574", 10.0);
+ otherRater.addRating("2354", 9.0);
+
+ System.out.print(
+ "Consider the method dotProduct in the FourthRatings class. What should the call "
+ + "dotProduct(“15”, “20”) return? ");
+ System.out.println(fourthRatings.dotProduct(meRater, otherRater));
+
+ MovieRunnerSimilarRatings quiz = new MovieRunnerSimilarRatings();
+ quiz.printSimilarRatings();
+ System.out.println("---");
+ quiz.printSimilarRatingsByGenre();
+ System.out.println("---");
+ quiz.printSimilarRatings();
+ System.out.println("---");
+ quiz.printSimilarRatingsByDirector();
+ System.out.println("---");
+ quiz.printSimilarRatingsByGenreAndMinutes();
+ System.out.println("---");
+ quiz.printSimilarRatingsByYearAfterAndMinutes();
+ }
+}
diff --git a/Week4/src/YearAfterFilter.java b/Week4/src/YearAfterFilter.java
new file mode 100644
index 0000000..ecb3e3a
--- /dev/null
+++ b/Week4/src/YearAfterFilter.java
@@ -0,0 +1,12 @@
+public class YearAfterFilter implements Filter {
+ private final int myYear;
+
+ public YearAfterFilter(int year) {
+ myYear = year;
+ }
+
+ @Override
+ public boolean satisfies(String id) {
+ return MovieDatabase.getYear(id) >= myYear;
+ }
+}