@@ -54,8 +54,9 @@ After setting up our model, there are several major steps to go through to train
Our program starts with importing necessary packages:
```python
importpaddle.v2aspaddle
importpaddle.v2.dataset.uci_housingasuci_housing
importpaddle
importpaddle.fluidasfluid
importnumpy
```
We encapsulated the [UCI Housing Data Set](https://archive.ics.uci.edu/ml/datasets/Housing) in our Python module `uci_housing`. This module can
...
...
@@ -116,49 +117,58 @@ When training complex models, we usually have one more split: the validation set
`fit_a_line/trainer.py` demonstrates the training using [PaddlePaddle](http://paddlepaddle.org).
### Initialize PaddlePaddle
### Datafeeder Configuration
```python
paddle.init(use_gpu=False,trainer_count=1)
```
We first define data feeders for test and train. The feeder reads a `BATCH_SIZE` of data each time and feed them to the training/testing process. Users can shuffle a batch out of a `buf_size` in order to make the data random.
### Model Configuration
```python
BATCH_SIZE=20
Linear regression is essentially a fully-connected layer with linear activation:
for loading the training data. A reader may return multiple columns, and we need a Python dictionary to specify the mapping from column index to data layers.
```python
feeding={'x':0,'y':1}
feed_order=['x','y']
```
Moreover, an event handler is provided to print the training progress:
```python
# event_handler to print training and testing info
@@ -96,8 +96,9 @@ After setting up our model, there are several major steps to go through to train
Our program starts with importing necessary packages:
```python
import paddle.v2 as paddle
import paddle.v2.dataset.uci_housing as uci_housing
import paddle
import paddle.fluid as fluid
import numpy
```
We encapsulated the [UCI Housing Data Set](https://archive.ics.uci.edu/ml/datasets/Housing) in our Python module `uci_housing`. This module can
...
...
@@ -158,49 +159,58 @@ When training complex models, we usually have one more split: the validation set
`fit_a_line/trainer.py` demonstrates the training using [PaddlePaddle](http://paddlepaddle.org).
### Initialize PaddlePaddle
### Datafeeder Configuration
```python
paddle.init(use_gpu=False, trainer_count=1)
```
We first define data feeders for test and train. The feeder reads a `BATCH_SIZE` of data each time and feed them to the training/testing process. Users can shuffle a batch out of a `buf_size` in order to make the data random.
### Model Configuration
```python
BATCH_SIZE = 20
Linear regression is essentially a fully-connected layer with linear activation:
for loading the training data. A reader may return multiple columns, and we need a Python dictionary to specify the mapping from column index to data layers.
```python
feeding={'x': 0, 'y': 1}
feed_order=['x', 'y']
```
Moreover, an event handler is provided to print the training progress:
```python
# event_handler to print training and testing info