Tor S - Octos - MediaRanker#21
Conversation
…e and works controller
…ion for user to only be able to vote once for a work, added tests for the validation
…e for a user or work in WorksHelper)
… the page and you remain on the page
…able to compile to deploy to heroku
…troller to handle missing or bad requests
Media RankerWhat We're Looking For
Great job overall! Your implementation matches the demo site very closely, and I would say the learning goals for this assignment were definitely met. There are a few places where things could be cleaned up, which I've tried to outline below, but in general I am quite happy with this submission. Particular problems I ran into:
I'm super impressed by your work on the recommender system! That was not intended to be an easy optional. Excellent work. If you want to keep tinkering with this, the next step is to think about performance. Every time you load a user you compare them to all the other users, which means complexity grows linearly with the number of users. How could you scale a system like this up to a million users, or 100 million? What trade-offs would you need to consider? If you're interested in seeing another complex algorithm implemented in a Rails app, our internship-placer-app has an interesting bit of logic under |
| recommendations = User.get_recommendations(top_similar, new_user) # this should probably not be a class method but it is for now for testing | ||
|
|
||
| return recommendations.empty? ? "no recommendations at this time" : recommendations.uniq | ||
| end |
There was a problem hiding this comment.
The condition in line 25 is display logic, and would probably fit better in the view.
| def top | ||
| @top_albums = Work.order_by_vote(categorize('album')).first(10) | ||
| @top_books = Work.order_by_vote(categorize('book')).first(10) | ||
| @top_movies = Work.order_by_vote(categorize('movie')).first(10) |
There was a problem hiding this comment.
These lines might work well as a model method, something like top_ten(category).
|
|
||
| <% if @albums %> | ||
| <%= render partial: 'display_work', locals: {category: 'Albums', model: @albums} %> | ||
| <% end %> |
There was a problem hiding this comment.
Good use of a partial to keep this DRY.
| it 'must calculate a jaccard index between a two users' do | ||
| result = User.calculate_jaccard(@tor, @roo) | ||
|
|
||
| result.must_equal 0.5 |
There was a problem hiding this comment.
I'm going to start by appreciating that you have test coverage here at all - it's easy to let it slip when you're working on a science project like this.
That being said, the test coverage here could probably stand to be more broad. What if one of the users doesn't have any votes? What if there is no intersect, or if the intersect is the union? Does it work with many works?
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
sessionandflash? What is the difference between them?