Skip to content

Commit

Permalink
Add indicies to print statements for older versions of Python
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTillman committed Sep 20, 2015
1 parent 8b0869f commit fdbb1c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion data/spark/recommendations_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class UUIDType(types.AtomicType):
video_ids = ratings.select("videoid").distinct().rdd.zipWithUniqueId().cache()
video_map = video_ids.map(lambda (x, y): Row(videoid=x.videoid, videoid_int=y)).toDF().cache()

print "Recommending based on {0} users and {1} videos.".format(user_map.count(), video_map.count())

training_data = ratings.join(user_map, ratings.userid == user_map.userid).\
join(video_map, ratings.videoid == video_map.videoid).\
select(user_map.userid, user_map.userid_int, video_map.videoid, video_map.videoid_int, "rating")
Expand All @@ -56,7 +58,7 @@ class UUIDType(types.AtomicType):
save(mode="append")

count += 1
print "{} ({}/{})".format(user.userid, count, length)
print "{0} ({1}/{2})".format(user.userid, count, length)

video_map.unpersist()

Expand Down

0 comments on commit fdbb1c3

Please sign in to comment.