0% found this document useful (0 votes)
57 views4 pages

Readdata PDF

Uploaded by

Bin Liu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views4 pages

Readdata PDF

Uploaded by

Bin Liu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

README.

md

1 # TensorFlow Examples
2
3 This tutorial was designed for easily diving into TensorFlow, through examples. For
readability, it includes both notebooks and source codes with explanation.
4
5 It is suitable for beginners who want to find clear and concise examples about
TensorFlow. Besides the traditional 'raw' TensorFlow implementations, you can also
find the latest TensorFlow API practices (such as `layers`, `estimator`, `
dataset`, ...).
6
7 **Update (07/25/2018):** Add new examples (GBDT, Word2Vec) + TF1.9 compatibility! (TF
v1.9+ recommended).
8
9 *If you are using older TensorFlow version (0.11 and under), please take a [look here](
https://github.com/aymericdamien/TensorFlow-Examples/tree/0.11).*
10
11 ## Tutorial index
12
13 #### 0 - Prerequisite
14 - [Introduction to Machine Learning](https://github.com/aymericdamien/TensorFlow-
Examples/blob/master/notebooks/0_Prerequisite/ml_introduction.ipynb).
15 - [Introduction to MNIST Dataset](https://github.com/aymericdamien/TensorFlow-Examples/
blob/master/notebooks/0_Prerequisite/mnist_dataset_intro.ipynb).
16
17 #### 1 - Introduction
18 - **Hello World** ([notebook](https://github.com/aymericdamien/TensorFlow-Examples/
blob/master/notebooks/1_Introduction/helloworld.ipynb)) ([code](https://github.com/
aymericdamien/TensorFlow-Examples/blob/master/examples/1_Introduction/helloworld.py)).
Very simple example to learn how to print "hello world" using TensorFlow.
19 - **Basic Operations** ([notebook](https://github.com/aymericdamien/TensorFlow-
Examples/blob/master/notebooks/1_Introduction/basic_operations.ipynb)) ([code](https://
github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/1_Introduction/
basic_operations.py)). A simple example that cover TensorFlow basic operations.
20 - **TensorFlow Eager API basics** ([notebook](https://github.com/aymericdamien/
TensorFlow-Examples/blob/master/notebooks/1_Introduction/basic_eager_api.ipynb)) ([
code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/
1_Introduction/basic_eager_api.py)). Get started with TensorFlow's Eager API.
21
22 #### 2 - Basic Models
23 - **Linear Regression** ([notebook](https://github.com/aymericdamien/TensorFlow-
Examples/blob/master/notebooks/2_BasicModels/linear_regression.ipynb)) ([code](https://
github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/2_BasicModels/
linear_regression.py)). Implement a Linear Regression with TensorFlow.
24 - **Linear Regression (eager api)** ([notebook](https://github.com/aymericdamien/
TensorFlow-Examples/blob/master/notebooks/2_BasicModels/linear_regression_eager_api.
ipynb)) ([code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/
examples/2_BasicModels/linear_regression_eager_api.py)). Implement a Linear Regression
using TensorFlow's Eager API.
25 - **Logistic Regression** ([notebook](https://github.com/aymericdamien/TensorFlow-
Examples/blob/master/notebooks/2_BasicModels/logistic_regression.ipynb)) ([code](
https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/
2_BasicModels/logistic_regression.py)). Implement a Logistic Regression with TensorFlow.
26 - **Logistic Regression (eager api)** ([notebook](https://github.com/aymericdamien/
TensorFlow-Examples/blob/master/notebooks/2_BasicModels/logistic_regression_eager_api.
ipynb)) ([code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/
examples/2_BasicModels/logistic_regression_eager_api.py)). Implement a Logistic
Regression using TensorFlow's Eager API.
27 - **Nearest Neighbor** ([notebook](https://github.com/aymericdamien/TensorFlow-
Examples/blob/master/notebooks/2_BasicModels/nearest_neighbor.ipynb)) ([code](https://
github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/2_BasicModels/
nearest_neighbor.py)). Implement Nearest Neighbor algorithm with TensorFlow.
28 - **K-Means** ([notebook](https://github.com/aymericdamien/TensorFlow-Examples/blob/
master/notebooks/2_BasicModels/kmeans.ipynb)) ([code](https://github.com/aymericdamien/
TensorFlow-Examples/blob/master/examples/2_BasicModels/kmeans.py)). Build a K-Means
classifier with TensorFlow.
29 - **Random Forest** ([notebook](https://github.com/aymericdamien/TensorFlow-Examples/
blob/master/notebooks/2_BasicModels/random_forest.ipynb)) ([code](https://github.com/
aymericdamien/TensorFlow-Examples/blob/master/examples/2_BasicModels/random_forest.
py)). Build a Random Forest classifier with TensorFlow.
30 - **Gradient Boosted Decision Tree (GBDT)** ([notebook](https://github.com/
aymericdamien/TensorFlow-Examples/blob/master/notebooks/2_BasicModels/
gradient_boosted_decision_tree.ipynb)) ([code](https://github.com/aymericdamien/
TensorFlow-Examples/blob/master/examples/2_BasicModels/gradient_boosted_decision_tree.

Page: 1 / 4
README.md

py)). Build a Gradient Boosted Decision Tree (GBDT) with TensorFlow.


31 - **Word2Vec (Word Embedding)** ([notebook](https://github.com/aymericdamien/
TensorFlow-Examples/blob/master/notebooks/2_BasicModels/word2vec.ipynb)) ([code](
https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/
2_BasicModels/word2vec.py)). Build a Word Embedding Model (Word2Vec) from Wikipedia
data, with TensorFlow.
32
33 #### 3 - Neural Networks
34 ##### Supervised
35
36 - **Simple Neural Network** ([notebook](https://github.com/aymericdamien/TensorFlow-
Examples/blob/master/notebooks/3_NeuralNetworks/neural_network_raw.ipynb)) ([code](
https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/
3_NeuralNetworks/neural_network_raw.py)). Build a simple neural network (a.k.a Multi-
layer Perceptron) to classify MNIST digits dataset. Raw TensorFlow implementation.
37 - **Simple Neural Network (tf.layers/estimator api)** ([notebook](https://github.com/
aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/
neural_network.ipynb)) ([code](https://github.com/aymericdamien/TensorFlow-Examples/
blob/master/examples/3_NeuralNetworks/neural_network.py)). Use TensorFlow 'layers'
and 'estimator' API to build a simple neural network (a.k.a Multi-layer Perceptron) to
classify MNIST digits dataset.
38 - **Simple Neural Network (eager api)** ([notebook](https://github.com/aymericdamien/
TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/neural_network_eager_api.
ipynb)) ([code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/
examples/3_NeuralNetworks/neural_network_eager_api.py)). Use TensorFlow Eager API to
build a simple neural network (a.k.a Multi-layer Perceptron) to classify MNIST digits
dataset.
39 - **Convolutional Neural Network** ([notebook](https://github.com/aymericdamien/
TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/convolutional_network_raw.
ipynb)) ([code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/
examples/3_NeuralNetworks/convolutional_network_raw.py)). Build a convolutional neural
network to classify MNIST digits dataset. Raw TensorFlow implementation.
40 - **Convolutional Neural Network (tf.layers/estimator api)** ([notebook](https://
github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/
convolutional_network.ipynb)) ([code](https://github.com/aymericdamien/TensorFlow-
Examples/blob/master/examples/3_NeuralNetworks/convolutional_network.py)). Use
TensorFlow 'layers' and 'estimator' API to build a convolutional neural network to
classify MNIST digits dataset.
41 - **Recurrent Neural Network (LSTM)** ([notebook](https://github.com/aymericdamien/
TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/recurrent_network.ipynb)) ([
code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/
3_NeuralNetworks/recurrent_network.py)). Build a recurrent neural network (LSTM) to
classify MNIST digits dataset.
42 - **Bi-directional Recurrent Neural Network (LSTM)** ([notebook](https://github.com/
aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/
bidirectional_rnn.ipynb)) ([code](https://github.com/aymericdamien/TensorFlow-Examples/
blob/master/examples/3_NeuralNetworks/bidirectional_rnn.py)). Build a bi-directional
recurrent neural network (LSTM) to classify MNIST digits dataset.
43 - **Dynamic Recurrent Neural Network (LSTM)** ([notebook](https://github.com/
aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/dynamic_rnn.
ipynb)) ([code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/
examples/3_NeuralNetworks/dynamic_rnn.py)). Build a recurrent neural network (LSTM)
that performs dynamic calculation to classify sequences of different length.
44
45 ##### Unsupervised
46 - **Auto-Encoder** ([notebook](https://github.com/aymericdamien/TensorFlow-Examples/
blob/master/notebooks/3_NeuralNetworks/autoencoder.ipynb)) ([code](https://github.com/
aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/autoencoder.
py)). Build an auto-encoder to encode an image to a lower dimension and re-construct it.
47 - **Variational Auto-Encoder** ([notebook](https://github.com/aymericdamien/TensorFlow-
Examples/blob/master/notebooks/3_NeuralNetworks/variational_autoencoder.ipynb)) ([
code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/
3_NeuralNetworks/variational_autoencoder.py)). Build a variational auto-encoder (VAE),
to encode and generate images from noise.
48 - **GAN (Generative Adversarial Networks)** ([notebook](https://github.com/
aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/gan.ipynb)) ([
code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/
3_NeuralNetworks/gan.py)). Build a Generative Adversarial Network (GAN) to generate
images from noise.
49 - **DCGAN (Deep Convolutional Generative Adversarial Networks)** ([notebook](https://
github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/
dcgan.ipynb)) ([code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/
examples/3_NeuralNetworks/dcgan.py)). Build a Deep Convolutional Generative

Page: 2 / 4
README.md

Adversarial Network (DCGAN) to generate images from noise.


50
51 #### 4 - Utilities
52 - **Save and Restore a model** ([notebook](https://github.com/aymericdamien/TensorFlow-
Examples/blob/master/notebooks/4_Utils/save_restore_model.ipynb)) ([code](https://
github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/4_Utils/
save_restore_model.py)). Save and Restore a model with TensorFlow.
53 - **Tensorboard - Graph and loss visualization** ([notebook](https://github.com/
aymericdamien/TensorFlow-Examples/blob/master/notebooks/4_Utils/tensorboard_basic.
ipynb)) ([code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/
examples/4_Utils/tensorboard_basic.py)). Use Tensorboard to visualize the computation
Graph and plot the loss.
54 - **Tensorboard - Advanced visualization** ([notebook](https://github.com/
aymericdamien/TensorFlow-Examples/blob/master/notebooks/4_Utils/tensorboard_advanced.
ipynb)) ([code](https://github.com/aymericdamien/TensorFlow-Examples/blob/master/
examples/4_Utils/tensorboard_advanced.py)). Going deeper into Tensorboard; visualize
the variables, gradients, and more...
55
56 #### 5 - Data Management
57 - **Build an image dataset** ([notebook](https://github.com/aymericdamien/TensorFlow-
Examples/blob/master/notebooks/5_DataManagement/build_an_image_dataset.ipynb)) ([code](
https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/
5_DataManagement/build_an_image_dataset.py)). Build your own images dataset with
TensorFlow data queues, from image folders or a dataset file.
58 - **TensorFlow Dataset API** ([notebook](https://github.com/aymericdamien/TensorFlow-
Examples/blob/master/notebooks/5_DataManagement/tensorflow_dataset_api.ipynb)) ([code](
https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/
5_DataManagement/tensorflow_dataset_api.py)). Introducing TensorFlow Dataset API for
optimizing the input data pipeline.
59
60 #### 6 - Multi GPU
61 - **Basic Operations on multi-GPU** ([notebook](https://github.com/aymericdamien/
TensorFlow-Examples/blob/master/notebooks/6_MultiGPU/multigpu_basics.ipynb)) ([code](
https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/6_MultiGPU/
multigpu_basics.py)). A simple example to introduce multi-GPU in TensorFlow.
62 - **Train a Neural Network on multi-GPU** ([notebook](https://github.com/aymericdamien/
TensorFlow-Examples/blob/master/notebooks/6_MultiGPU/multigpu_cnn.ipynb)) ([code](
https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/6_MultiGPU/
multigpu_cnn.py)). A clear and simple TensorFlow implementation to train a
convolutional neural network on multiple GPUs.
63
64 ## Dataset
65 Some examples require MNIST dataset for training and testing. Don't worry, this
dataset will automatically be downloaded when running examples.
66 MNIST is a database of handwritten digits, for a quick description of that dataset,
you can check [this notebook](https://github.com/aymericdamien/TensorFlow-Examples/
blob/master/notebooks/0_Prerequisite/mnist_dataset_intro.ipynb).
67
68 Official Website: [http://yann.lecun.com/exdb/mnist/](http://yann.lecun.com/exdb/mnist/)
69
70 ## Installation
71
72 To download all the examples, simply clone this repository:
73 ```
74 git clone https://github.com/aymericdamien/TensorFlow-Examples
75 ```
76
77 To run them, you also need the latest version of TensorFlow. To install it:
78 ```
79 pip install tensorflow
80 ```
81
82 or (if you want GPU support):
83 ```
84 pip install tensorflow_gpu
85 ```
86
87 For more details about TensorFlow installation, you can check [TensorFlow Installation
Guide](https://www.tensorflow.org/install/)
88
89 ## More Examples
90 The following examples are coming from [TFLearn](https://github.com/tflearn/tflearn),
a library that provides a simplified interface for TensorFlow. You can have a look,

Page: 3 / 4
README.md

there are many [examples](https://github.com/tflearn/tflearn/tree/master/examples)


and [pre-built operations and layers](http://tflearn.org/doc_index/#api).
91
92 ### Tutorials
93 - [TFLearn Quickstart](https://github.com/tflearn/tflearn/blob/master/tutorials/intro/
quickstart.md). Learn the basics of TFLearn through a concrete machine learning task.
Build and train a deep neural network classifier.
94
95 ### Examples
96 - [TFLearn Examples](https://github.com/tflearn/tflearn/blob/master/examples). A large
collection of examples using TFLearn.
97

Page: 4 / 4

You might also like