diff --git a/05.recommender_system/README.cn.md b/05.recommender_system/README.cn.md index f3e1b40d3a6633f280deaa07518d2fdfc981a10a..2bbfc3c12a127a55d200c7c1d05cb1c6e466f666 100644 --- a/05.recommender_system/README.cn.md +++ b/05.recommender_system/README.cn.md @@ -136,7 +136,7 @@ Paddle在API中提供了自动加载数据的模块。数据模块为 `paddle.da ```python import paddle movie_info = paddle.dataset.movielens.movie_info() -print movie_info.values()[0] +print(list(movie_info.values())[0]) ``` @@ -152,7 +152,7 @@ print movie_info.values()[0] ```python movie_info = paddle.dataset.movielens.movie_info() -print movie_info.values()[0] +print(list(movie_info.values())[0]) ``` @@ -163,7 +163,7 @@ print movie_info.values()[0] ```python user_info = paddle.dataset.movielens.user_info() -print user_info.values()[0] +print(list(user_info.values())[0]) ``` @@ -216,7 +216,7 @@ train_set_creator = paddle.dataset.movielens.train() train_sample = next(train_set_creator()) uid = train_sample[0] mov_id = train_sample[len(user_info[uid].value())] -print "User %s rates Movie %s with Score %s"%(user_info[uid], movie_info[mov_id], train_sample[-1]) +print("User %s rates Movie %s with Score %s"%(user_info[uid], movie_info[mov_id], train_sample[-1])) ``` User rates Movie with Score [5.0] @@ -533,13 +533,13 @@ train_loop() ```python infer_movie_id = 783 infer_movie_name = paddle.dataset.movielens.movie_info()[infer_movie_id].title -user_id = fluid.create_lod_tensor([[np.int64(1)]], [[1]], place) -gender_id = fluid.create_lod_tensor([[np.int64(1)]], [[1]], place) -age_id = fluid.create_lod_tensor([[np.int64(0)]], [[1]], place) -job_id = fluid.create_lod_tensor([[np.int64(10)]], [[1]], place) -movie_id = fluid.create_lod_tensor([[np.int64(783)]], [[1]], place) # Hunchback of Notre Dame -category_id = fluid.create_lod_tensor([np.array([10, 8, 9], dtype='int64')], [[3]], place) # Animation, Children's, Musical -movie_title = fluid.create_lod_tensor([np.array([1069, 4140, 2923, 710, 988], dtype='int64')], [[5]], +user_id = fluid.create_lod_tensor([[1]], [[1]], place) +gender_id = fluid.create_lod_tensor([[1]], [[1]], place) +age_id = fluid.create_lod_tensor([[0]], [[1]], place) +job_id = fluid.create_lod_tensor([[10]], [[1]], place) +movie_id = fluid.create_lod_tensor([[783]], [[1]], place) # Hunchback of Notre Dame +category_id = fluid.create_lod_tensor([[10, 8, 9]], [[3]], place) # Animation, Children's, Musical +movie_title = fluid.create_lod_tensor([[1069, 4140, 2923, 710, 988]], [[5]], place) # 'hunchback','of','notre','dame','the' ``` diff --git a/05.recommender_system/README.md b/05.recommender_system/README.md index 01f5c6149aba72446d679d4dc65be6ca8dc773c8..cb74fe9b977631fb9b10d5bd679b13bf5aea9bd5 100644 --- a/05.recommender_system/README.md +++ b/05.recommender_system/README.md @@ -122,7 +122,7 @@ Paddle provides modules for automatically loading data in the API. The data modu ```python import paddle movie_info = paddle.dataset.movielens.movie_info() -print movie_info.values()[0] +print(list(movie_info.values())[0]) ``` @@ -138,7 +138,7 @@ For example, one of the movie features is: ```python movie_info = paddle.dataset.movielens.movie_info() -print movie_info.values()[0] +print(list(movie_info.values())[0]) ``` @@ -149,7 +149,7 @@ This means that the movie id is 1, and the title is 《Toy Story》, which is di ```python user_info = paddle.dataset.movielens.user_info() -print user_info.values()[0] +print(list(user_info.values())[0]) ``` @@ -202,7 +202,7 @@ train_set_creator = paddle.dataset.movielens.train() train_sample = next(train_set_creator()) uid = train_sample[0] mov_id = train_sample[len(user_info[uid].value())] -print "User %s rates Movie %s with Score %s"%(user_info[uid], movie_info[mov_id], train_sample[-1]) +print("User %s rates Movie %s with Score %s"%(user_info[uid], movie_info[mov_id], train_sample[-1])) ``` ```python diff --git a/05.recommender_system/index.cn.html b/05.recommender_system/index.cn.html index b8dadd3819b4c63ed0e9581da279591cf0d15240..485693a3dcd994a75e20e8bbe7d963989ff7516f 100644 --- a/05.recommender_system/index.cn.html +++ b/05.recommender_system/index.cn.html @@ -178,7 +178,7 @@ Paddle在API中提供了自动加载数据的模块。数据模块为 `paddle.da ```python import paddle movie_info = paddle.dataset.movielens.movie_info() -print movie_info.values()[0] +print(list(movie_info.values())[0]) ``` @@ -194,7 +194,7 @@ print movie_info.values()[0] ```python movie_info = paddle.dataset.movielens.movie_info() -print movie_info.values()[0] +print(list(movie_info.values())[0]) ``` @@ -205,7 +205,7 @@ print movie_info.values()[0] ```python user_info = paddle.dataset.movielens.user_info() -print user_info.values()[0] +print(list(user_info.values())[0]) ``` @@ -258,7 +258,7 @@ train_set_creator = paddle.dataset.movielens.train() train_sample = next(train_set_creator()) uid = train_sample[0] mov_id = train_sample[len(user_info[uid].value())] -print "User %s rates Movie %s with Score %s"%(user_info[uid], movie_info[mov_id], train_sample[-1]) +print("User %s rates Movie %s with Score %s"%(user_info[uid], movie_info[mov_id], train_sample[-1])) ``` User rates Movie with Score [5.0] @@ -575,13 +575,13 @@ train_loop() ```python infer_movie_id = 783 infer_movie_name = paddle.dataset.movielens.movie_info()[infer_movie_id].title -user_id = fluid.create_lod_tensor([[np.int64(1)]], [[1]], place) -gender_id = fluid.create_lod_tensor([[np.int64(1)]], [[1]], place) -age_id = fluid.create_lod_tensor([[np.int64(0)]], [[1]], place) -job_id = fluid.create_lod_tensor([[np.int64(10)]], [[1]], place) -movie_id = fluid.create_lod_tensor([[np.int64(783)]], [[1]], place) # Hunchback of Notre Dame -category_id = fluid.create_lod_tensor([np.array([10, 8, 9], dtype='int64')], [[3]], place) # Animation, Children's, Musical -movie_title = fluid.create_lod_tensor([np.array([1069, 4140, 2923, 710, 988], dtype='int64')], [[5]], +user_id = fluid.create_lod_tensor([[1]], [[1]], place) +gender_id = fluid.create_lod_tensor([[1]], [[1]], place) +age_id = fluid.create_lod_tensor([[0]], [[1]], place) +job_id = fluid.create_lod_tensor([[10]], [[1]], place) +movie_id = fluid.create_lod_tensor([[783]], [[1]], place) # Hunchback of Notre Dame +category_id = fluid.create_lod_tensor([[10, 8, 9]], [[3]], place) # Animation, Children's, Musical +movie_title = fluid.create_lod_tensor([[1069, 4140, 2923, 710, 988]], [[5]], place) # 'hunchback','of','notre','dame','the' ``` diff --git a/05.recommender_system/index.html b/05.recommender_system/index.html index 20665beb686707354b4651a8187e2b5df60ee33c..2c7d9552c704c74f4f3ca5b7146e3982efbb075c 100644 --- a/05.recommender_system/index.html +++ b/05.recommender_system/index.html @@ -164,7 +164,7 @@ Paddle provides modules for automatically loading data in the API. The data modu ```python import paddle movie_info = paddle.dataset.movielens.movie_info() -print movie_info.values()[0] +print(list(movie_info.values())[0]) ``` @@ -180,7 +180,7 @@ For example, one of the movie features is: ```python movie_info = paddle.dataset.movielens.movie_info() -print movie_info.values()[0] +print(list(movie_info.values())[0]) ``` @@ -191,7 +191,7 @@ This means that the movie id is 1, and the title is 《Toy Story》, which is di ```python user_info = paddle.dataset.movielens.user_info() -print user_info.values()[0] +print(list(user_info.values())[0]) ``` @@ -244,7 +244,7 @@ train_set_creator = paddle.dataset.movielens.train() train_sample = next(train_set_creator()) uid = train_sample[0] mov_id = train_sample[len(user_info[uid].value())] -print "User %s rates Movie %s with Score %s"%(user_info[uid], movie_info[mov_id], train_sample[-1]) +print("User %s rates Movie %s with Score %s"%(user_info[uid], movie_info[mov_id], train_sample[-1])) ``` ```python