index_en.rst 1.4 KB
Newer Older
L
Luo Tao 已提交
1 2 3
GET STARTED
============

T
typhoonzero 已提交
4 5 6 7 8
.. _quick_install:

Quick Install
----------------------

T
typhoonzero 已提交
9
You can use pip to install PaddlePaddle with a single command, supports
T
typhoonzero 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
CentOS 6 above, Ubuntu 14.04 above or MacOS 10.12, with Python 2.7 installed.
Simply run the following command to install:

  .. code-block:: bash

     pip install paddlepaddle

If you need to install GPU version, run:

  .. code-block:: bash

     pip install paddlepaddle-gpu

For more details about installation and build:

L
Luo Tao 已提交
25
..  toctree::
26
  :maxdepth: 1
L
Luo Tao 已提交
27 28

  build_and_install/index_en.rst
29

T
typhoonzero 已提交
30 31 32 33 34 35

.. _quick_start:

Quick Start
++++++++

T
typhoonzero 已提交
36 37
Create a new file called housing.py, and paste this Python
code:
T
typhoonzero 已提交
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52


  .. code-block:: python

     import paddle.v2 as paddle

     # Initialize PaddlePaddle.
     paddle.init(use_gpu=False, trainer_count=1)

     # Configure the neural network.
     x = paddle.layer.data(name='x', type=paddle.data_type.dense_vector(13))
     y_predict = paddle.layer.fc(input=x, size=1, act=paddle.activation.Linear())

     # Infer using provided test data.
     probs = paddle.infer(
T
typhoonzero 已提交
53 54 55
         output_layer=y_predict,
         parameters=paddle.dataset.uci_housing.model(),
         input=[item for item in paddle.dataset.uci_housing.test()()])
T
typhoonzero 已提交
56 57

     for i in xrange(len(probs)):
T
typhoonzero 已提交
58
         print 'Predicted price: ${:,.2f}'.format(probs[i][0] * 1000)
T
typhoonzero 已提交
59 60 61

Run :code:`python housing.py` and voila! It should print out a list of predictions
for the test housing data.