提交 8b510ba0 编写于 作者: C Chen Weihang

style: polish the result print style in README.cn and train.py

上级 d4414cbb
......@@ -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.")
```
## 总结
......
......@@ -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
......
......@@ -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.")
```
## 总结
......
......@@ -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
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册