Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
book
提交
d868ad50
B
book
项目概览
PaddlePaddle
/
book
通知
16
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
40
列表
看板
标记
里程碑
合并请求
37
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
B
book
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
40
Issue
40
列表
看板
标记
里程碑
合并请求
37
合并请求
37
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
d868ad50
编写于
7月 19, 2018
作者:
C
Chen Weihang
提交者:
GitHub
7月 19, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #577 from chenwhql/book05_refine
05 Style: polish the result print style
上级
d4414cbb
8b510ba0
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
20 addition
and
1 deletion
+20
-1
05.recommender_system/README.cn.md
05.recommender_system/README.cn.md
+6
-0
05.recommender_system/README.md
05.recommender_system/README.md
+1
-0
05.recommender_system/index.cn.html
05.recommender_system/index.cn.html
+6
-0
05.recommender_system/index.html
05.recommender_system/index.html
+1
-0
05.recommender_system/train.py
05.recommender_system/train.py
+6
-1
未找到文件。
05.recommender_system/README.cn.md
浏览文件 @
d868ad50
...
...
@@ -215,6 +215,7 @@ print "User %s rates Movie %s with Score %s"%(user_info[uid], movie_info[mov_id]
```
python
from
__future__
import
print_function
import
math
import
sys
import
numpy
as
np
...
...
@@ -508,6 +509,11 @@ results = inferencer.infer(
'movie_title'
:
movie_title
},
return_numpy
=
False
)
predict_rating
=
np
.
array
(
results
[
0
])
print
(
"Predict Rating of user id 1 on movie
\"
"
+
infer_movie_name
+
"
\"
is "
+
str
(
predict_rating
[
0
][
0
]))
print
(
"Actual Rating of user id 1 on movie
\"
"
+
infer_movie_name
+
"
\"
is 4."
)
```
## 总结
...
...
05.recommender_system/README.md
浏览文件 @
d868ad50
...
...
@@ -185,6 +185,7 @@ After issuing a command `python train.py`, training will start immediately. The
Our program starts with importing necessary packages and initializing some global variables:
```
python
from
__future__
import
print_function
import
math
import
sys
import
numpy
as
np
...
...
05.recommender_system/index.cn.html
浏览文件 @
d868ad50
...
...
@@ -257,6 +257,7 @@ print "User %s rates Movie %s with Score %s"%(user_info[uid], movie_info[mov_id]
```python
from __future__ import print_function
import math
import sys
import numpy as np
...
...
@@ -550,6 +551,11 @@ results = inferencer.infer(
'movie_title': movie_title
},
return_numpy=False)
predict_rating = np.array(results[0])
print("Predict Rating of user id 1 on movie \"" + infer_movie_name + "\" is " + str(predict_rating[0][0]))
print("Actual Rating of user id 1 on movie \"" + infer_movie_name + "\" is 4.")
```
## 总结
...
...
05.recommender_system/index.html
浏览文件 @
d868ad50
...
...
@@ -227,6 +227,7 @@ After issuing a command `python train.py`, training will start immediately. The
Our program starts with importing necessary packages and initializing some global variables:
```python
from __future__ import print_function
import math
import sys
import numpy as np
...
...
05.recommender_system/train.py
浏览文件 @
d868ad50
...
...
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
__future__
import
print_function
import
math
import
sys
import
numpy
as
np
...
...
@@ -233,7 +234,11 @@ def infer(use_cuda, inference_program, params_dirname):
},
return_numpy
=
False
)
print
(
"infer results: "
,
np
.
array
(
results
[
0
]))
predict_rating
=
np
.
array
(
results
[
0
])
print
(
"Predict Rating of user id 1 on movie
\"
"
+
infer_movie_name
+
"
\"
is "
+
str
(
predict_rating
[
0
][
0
]))
print
(
"Actual Rating of user id 1 on movie
\"
"
+
infer_movie_name
+
"
\"
is 4."
)
def
main
(
use_cuda
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录