-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFourthRatingsOptimizedBySudan.ctxt
15 lines (15 loc) · 3.75 KB
/
FourthRatingsOptimizedBySudan.ctxt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#BlueJ class context
comment0.target=FourthRatingsOptimizedBySudan
comment1.params=me\ r
comment1.target=double\ dotProduct(Rater,\ Rater)
comment2.params=raterId
comment2.target=java.util.ArrayList\ getSimilarities(java.lang.String)
comment2.text=\n\ Write\ the\ private\ method\ named\ getSimilarities,\ which\ has\ one\ String\ parameter\n\ named\ id\u2014this\ method\ computes\ a\ similarity\ rating\ for\ each\ rater\ in\ the\n\ RaterDatabase\ (except\ the\ rater\ with\ the\ ID\ given\ by\ the\ parameter)\ to\ see\n\ how\ similar\ they\ are\ to\ the\ Rater\ whose\ ID\ is\ the\ parameter\ to\ getSimilarities.\n\ <p>\n\ This\ method\ returns\ an\ ArrayList\ of\ type\ Rating\ sorted\ by\ ratings\ from\ highest\ to\n\ lowest\ rating\ with\ the\ highest\ rating\ first\ and\ only\ including\ those\ raters\ who\ have\ a\n\ positive\ similarity\ rating\ since\ those\ with\ negative\ values\ are\ not\ similar\ in\ any\ way.\n\ Note\ that\ in\ each\ Rating\ object\ the\ "item\ field\ is\ a\ rater\u2019s\ ID,\ and\ the\ value\ field\n\ is\ the\ dot\ product"\ comparison\ between\ that\ rater\ and\ the\ rater\ whose\ ID\ is\ the\n\ parameter\ to\ getSimilarities.\n\ <p>\n\ Be\ sure\ not\ to\ use\ the\ dotProduct\ method\ with\ parameter\ id\ and\ itself\!\n
comment3.params=raterID\ numSimilarRaters\ minimalRaters
comment3.target=java.util.ArrayList\ getSimilarRatings(java.lang.String,\ int,\ int)
comment3.text=\n\ This\ method\ should\ return\ an\ ArrayList\ of\ type\ Rating,\ of\ movies\ and\n\ their\ weighted\ average\ ratings\ using\ only\ the\ top\ numSimilarRaters\ with\n\ positive\ ratings\ and\ including\ only\ those\ movies\ that\ have\ at\ least\ minimalRaters\n\ ratings\ from\ those\ most\ similar\ raters\ (not\ just\ minimalRaters\ ratings\ overall).\n\ <p>\n\ For\ example,\ if\ minimalRaters\ is\ 3\ and\ a\ movie\ has\ 4\ ratings\ but\ only\ 2\ of\n\ those\ ratings\ were\ made\ by\ raters\ in\ the\ top\ numSimilarRaters,\ that\ movie\n\ should\ not\ be\ included.\n\ <p>\n\ For\ each\ movie,\ calculate\ a\ weighted\ average\ movie\ rating\ based\ on\:\n\ Use\ only\ the\ top\ (largest)\ numSimilarRaters\ raters.\n\ For\ each\ of\ these\ raters,\ multiply\ their\ similarity\ rating\ by\ the\ rating\n\ they\ gave\ that\ movie.\ This\ will\ emphasize\ those\ raters\ who\ are\ closer\ to\ the\ rater\ id,\n\ since\ they\ have\ greater\ weights.\ The\ weighted\ average\ movie\ rating\ for\ a\n\ particular\ movie\ is\ the\ sum\ of\ these\ weighted\ average\ rating\n\ (for\ each\ rater\ multiply\ their\ similarity\ rating\ by\ their\ rating\ for\ the\ movie),\ divided\ by\ the\ total\ number\ of\ such\ ratings.\n\ <p>\n\ IMPORTANT\ NOTICE\:\n\ Weighted\ average\ algorithm\ optimized\ by\ sudan\n\ Instead\ of\ \ "sum\ of\ (similar\ rating(i)\ *rating\ of\ the\ movie(i))/count\ of\ the\ raters"\n\ \!\!\!\!\!I\ use\ \ "sum\ of\ (similar\ rating(i)\ *rating\ of\ the\ movie(i))/\ sum\ of\ the\ similar\ rating(i),\ will\ get\ more\ good\ results.\n\ <p>\n\ For\ example\:\ in\ short\ movie\ and\ short\ rating\ csv\n\ RaterID\ \=\ 2;\n\ //\ \ \ \ \ *\ rater\ id\ \=\ 5\ dotProduct\ 31.0\n\ //\ \ \ \ \ *\ rater\ id\ \=\ 3\ dotProduct\ 20.0\n\ //\ \ \ \ \ *\ rater\ id\ \=\ 1\ dotProduct\ 20.0\n\ //\ \ \ \ \ *\ rater\ id\ \=\ 4\ dotProduct\ 17.0\n\ Movie\ id\ \=\ 0068646\ id\ \=\ 5\ rating\ 9.0\ ave\ 279.0\n\ Movie\ id\ \=\ 0068646\ id\ \=\ 1\ rating\ 10.0\ ave\ 479.0\n\ Movie\ id\ \=\ 0068646\ count\ 2\ \:\ \ sudan\ Algorithm\ 9.392156862745098\ DUKE\ ALGORITHM\:\ 239.5\n\ (9*31+10*20)/50\=279+200\=479/51\=9.39\n\ (9*31+10*20)/2\ \=\ 479/2\ \=\ 239.5\n
comment4.params=raterID\ numSimilarRaters\ minimalRaters\ f
comment4.target=java.util.ArrayList\ getSimilarRatingsByFilter(java.lang.String,\ int,\ int,\ Filter)
comment5.params=args
comment5.target=void\ main(java.lang.String[])
numComments=6