Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from mrjob.job import MRJob
- class MRRatingCounter(MRJob):
- def mapper(self, key, line):
- (userID, movieID, rating, timestamp) = line.split("t")
- yield rating, 1
- def reducer(self, rating, occurences):
- yield rating, sum(occurences)
- if __name__ == "main__":
- MRRatingCounter.run()
- filepath = "01.ml-100k/u.data"
- MRRatingCounter(filepath)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement