提交 d4b40024 编写于 作者: Q qiaolongfei

add inference for book chapter 1

上级 fc0c3aea
......@@ -222,6 +222,33 @@ trainer.train(
![png](./image/train_and_test.png)
### Apply model
#### 1. generate testing data
```python
test_data_creator = paddle.dataset.uci_housing.test()
test_data = []
for item in test_data_creator():
test_data.append((item[0], ))
if len(test_data) == 5:
break
for data in test_data:
print data
```
#### 2. inference
```python
probs = paddle.infer(
output_layer=y_predict, parameters=parameters, input=test_data)
for data in probs:
print data
```
## Summary
This chapter introduces *Linear Regression* and how to train and test this model with PaddlePaddle, using the UCI Housing Data Set. Because a large number of more complex models and techniques are derived from linear regression, it is important to understand its underlying theory and limitation.
......
......@@ -217,6 +217,33 @@ trainer.train(
![png](./image/train_and_test.png)
### 应用模型
#### 1. 生成测试数据
```python
test_data_creator = paddle.dataset.uci_housing.test()
test_data = []
for item in test_data_creator():
test_data.append((item[0], ))
if len(test_data) == 5:
break
for data in test_data:
print data
```
#### 2. 推测 inference
```python
probs = paddle.infer(
output_layer=y_predict, parameters=parameters, input=test_data)
for data in probs:
print data
```
## 总结
在这章里,我们借助波士顿房价这一数据集,介绍了线性回归模型的基本概念,以及如何使用PaddlePaddle实现训练和测试的过程。很多的模型和技巧都是从简单的线性回归模型演化而来,因此弄清楚线性模型的原理和局限非常重要。
......
......@@ -264,6 +264,33 @@ trainer.train(
![png](./image/train_and_test.png)
### Apply model
#### 1. generate testing data
```python
test_data_creator = paddle.dataset.uci_housing.test()
test_data = []
for item in test_data_creator():
test_data.append((item[0], ))
if len(test_data) == 5:
break
for data in test_data:
print data
```
#### 2. inference
```python
probs = paddle.infer(
output_layer=y_predict, parameters=parameters, input=test_data)
for data in probs:
print data
```
## Summary
This chapter introduces *Linear Regression* and how to train and test this model with PaddlePaddle, using the UCI Housing Data Set. Because a large number of more complex models and techniques are derived from linear regression, it is important to understand its underlying theory and limitation.
......
......@@ -259,6 +259,33 @@ trainer.train(
![png](./image/train_and_test.png)
### 应用模型
#### 1. 生成测试数据
```python
test_data_creator = paddle.dataset.uci_housing.test()
test_data = []
for item in test_data_creator():
test_data.append((item[0], ))
if len(test_data) == 5:
break
for data in test_data:
print data
```
#### 2. 推测 inference
```python
probs = paddle.infer(
output_layer=y_predict, parameters=parameters, input=test_data)
for data in probs:
print data
```
## 总结
在这章里,我们借助波士顿房价这一数据集,介绍了线性回归模型的基本概念,以及如何使用PaddlePaddle实现训练和测试的过程。很多的模型和技巧都是从简单的线性回归模型演化而来,因此弄清楚线性模型的原理和局限非常重要。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册