资源|TensorFlow实现流行机器学习算法教程汇集

文章来源:Github

本文是TensorFlow实现流行机器学习算法的教程汇集,目标是让读者可以轻松通过清晰简明的案例深入了解 TensorFlow。这些案例适合那些想要实现一些TensorFlow案例的初学者。本教程包含还包含笔记和带有注解的代码。

第一步:给TF新手的教程指南

1:tf初学者需要明白的入门准备

机器学习入门笔记:

https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/0_Prerequisite/ml_introduction.ipynb

MNIST 数据集入门笔记

https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/0_Prerequisite/mnist_dataset_intro.ipynb

2:tf初学者需要了解的入门基础

Hello World

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/1_Introduction/helloworld.ipynb

基本操作代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/1_Introduction/helloworld.py

基本操作

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/1_Introduction/basic_operations.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/1_Introduction/basic_operations.py

3:tf初学者需要掌握的基本模型

最近邻:

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/2_BasicModels/nearest_neighbor.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/2_BasicModels/nearest_neighbor.py

线性回归:

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/2_BasicModels/linear_regression.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/2_BasicModels/linear_regression.py

Logistic 回归:

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/2_BasicModels/logistic_regression.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/2_BasicModels/logistic_regression.py

4:tf初学者需要尝试的神经网络

多层感知器:

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/multilayer_perceptron.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/multilayer_perceptron.py

卷积神经网络:

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/convolutional_network.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/convolutional_network.py

循环神经网络(LSTM):

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/recurrent_network.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/recurrent_network.py

双向循环神经网络(LSTM):

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/bidirectional_rnn.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/bidirectional_rnn.py

动态循环神经网络(LSTM)

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/dynamic_rnn.py

自编码器

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/autoencoder.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/autoencoder.py

5:tf初学者需要精通的实用技术

保存和恢复模型

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/4_Utils/save_restore_model.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/4_Utils/save_restore_model.py

图和损失可视化

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/4_Utils/tensorboard_basic.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/4_Utils/tensorboard_basic.py

Tensorboard——高级可视化

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/4_Utils/tensorboard_advanced.py

5:tf初学者需要的懂得的多GPU基本操作

多 GPU 上的基本操作

笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/5_MultiGPU/multigpu_basics.ipynb

代码:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/5_MultiGPU/multigpu_basics.py

6:案例需要的数据集

有一些案例需要 MNIST 数据集进行训练和测试。运行这些案例时,该数据集会被自动下载下来(使用 input_data.py)。

MNIST数据集笔记:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/0_Prerequisite/mnist_dataset_intro.ipynb

官方网站:http://yann.lecun.com/exdb/mnist/

第二步:为TF新手备的各个类型的案例、模型和数据集

初步了解:TFLearnTensorFlow

接下来的示例来自TFLearn,这是一个为 TensorFlow 提供了简化的接口的库。里面有很多示例和预构建的运算和层。

使用教程:TFLearn 快速入门。通过一个具体的机器学习任务学习 TFLearn 基础。开发和训练一个深度神经网络分类器。

TFLearn地址:https://github.com/tflearn/tflearn

示例:https://github.com/tflearn/tflearn/tree/master/examples

预构建的运算和层:http://tflearn.org/doc_index/#api

笔记:https://github.com/tflearn/tflearn/blob/master/tutorials/intro/quickstart.md

基础模型以及数据集

线性回归,使用 TFLearn 实现线性回归

https://github.com/tflearn/tflearn/blob/master/examples/basics/linear_regression.py

逻辑运算符。使用 TFLearn 实现逻辑运算符

https://github.com/tflearn/tflearn/blob/master/examples/basics/logical.py

权重保持。保存和还原一个模型

https://github.com/tflearn/tflearn/blob/master/examples/basics/weights_persistence.py

微调。在一个新任务上微调一个预训练的模型

https://github.com/tflearn/tflearn/blob/master/examples/basics/finetuning.py

使用 HDF5。使用 HDF5 处理大型数据集

https://github.com/tflearn/tflearn/blob/master/examples/basics/use_hdf5.py

使用 DASK。使用 DASK 处理大型数据集

https://github.com/tflearn/tflearn/blob/master/examples/basics/use_dask.py

计算机视觉模型及数据集

多层感知器。一种用于 MNIST 分类任务的多层感知实现

https://github.com/tflearn/tflearn/blob/master/examples/images/dnn.py

卷积网络(MNIST)。用于分类 MNIST 数据集的一种卷积神经网络实现

https://github.com/tflearn/tflearn/blob/master/examples/images/convnet_mnist.py

卷积网络(CIFAR-10)。用于分类 CIFAR-10 数据集的一种卷积神经网络实现

https://github.com/tflearn/tflearn/blob/master/examples/images/convnet_cifar10.py

网络中的网络。用于分类 CIFAR-10 数据集的 Network in Network 实现

https://github.com/tflearn/tflearn/blob/master/examples/images/network_in_network.py

Alexnet。将 Alexnet 应用于 Oxford Flowers 17 分类任务

https://github.com/tflearn/tflearn/blob/master/examples/images/alexnet.py

VGGNet。将 VGGNet 应用于 Oxford Flowers 17 分类任务

https://github.com/tflearn/tflearn/blob/master/examples/images/vgg_network.py

VGGNet Finetuning (Fast Training)。使用一个预训练的 VGG 网络并将其约束到你自己的数据上,以便实现快速训练

https://github.com/tflearn/tflearn/blob/master/examples/images/vgg_network_finetuning.py

RNN Pixels。使用 RNN(在像素的序列上)分类图像

https://github.com/tflearn/tflearn/blob/master/examples/images/rnn_pixels.py

Highway Network。用于分类 MNIST 数据集的 Highway Network 实现

https://github.com/tflearn/tflearn/blob/master/examples/images/highway_dnn.py

Highway Convolutional Network。用于分类 MNIST 数据集的 Highway Convolutional Network 实现

https://github.com/tflearn/tflearn/blob/master/examples/images/convnet_highway_mnist.py

Residual Network (MNIST) 。应用于 MNIST 分类任务的一种瓶颈残差网络(bottleneck residual network)

https://github.com/tflearn/tflearn/blob/master/examples/images/residual_network_mnist.py

Residual Network (CIFAR-10)。应用于 CIFAR-10 分类任务的一种残差网络

https://github.com/tflearn/tflearn/blob/master/examples/images/residual_network_cifar10.py

Google Inception(v3)。应用于 Oxford Flowers 17 分类任务的谷歌 Inception v3 网络

https://github.com/tflearn/tflearn/blob/master/examples/images/googlenet.py

自编码器。用于 MNIST 手写数字的自编码器

https://github.com/tflearn/tflearn/blob/master/examples/images/autoencoder.py

自然语言处理模型及数据集

循环神经网络(LSTM),应用 LSTM 到 IMDB 情感数据集分类任

https://github.com/tflearn/tflearn/blob/master/examples/nlp/lstm.py

双向 RNN(LSTM),将一个双向 LSTM 应用到 IMDB 情感数据集分类任务:

https://github.com/tflearn/tflearn/blob/master/examples/nlp/bidirectional_lstm.py

动态 RNN(LSTM),利用动态 LSTM 从 IMDB 数据集分类可变长度文本:

https://github.com/tflearn/tflearn/blob/master/examples/nlp/dynamic_lstm.py

城市名称生成,使用 LSTM 网络生成新的美国城市名:

https://github.com/tflearn/tflearn/blob/master/examples/nlp/lstm_generator_cityname.py

莎士比亚手稿生成,使用 LSTM 网络生成新的莎士比亚手稿:

https://github.com/tflearn/tflearn/blob/master/examples/nlp/lstm_generator_shakespeare.py

Seq2seq,seq2seq 循环网络的教学示例:

https://github.com/tflearn/tflearn/blob/master/examples/nlp/seq2seq_example.py

CNN Seq,应用一个 1-D 卷积网络从 IMDB 情感数据集中分类词序列

https://github.com/tflearn/tflearn/blob/master/examples/nlp/cnn_sentence_classification.py

强化学习案例

Atari Pacman 1-step Q-Learning,使用 1-step Q-learning 教一台机器玩 Atari 游戏:

https://github.com/tflearn/tflearn/blob/master/examples/reinforcement_learning/atari_1step_qlearning.py

第三步:为TF新手准备的其他方面内容

Recommender-Wide&Deep Network,推荐系统中 wide & deep 网络的教学示例:

https://github.com/tflearn/tflearn/blob/master/examples/others/recommender_wide_and_deep.py

Spiral Classification Problem,对斯坦福 CS231n spiral 分类难题的 TFLearn 实现:

https://github.com/tflearn/tflearn/blob/master/examples/notebooks/spiral.ipynb

层,与 TensorFlow 一起使用  TFLearn 层:

https://github.com/tflearn/tflearn/blob/master/examples/extending_tensorflow/layers.py

训练器,使用 TFLearn 训练器类训练任何 TensorFlow 图:

https://github.com/tflearn/tflearn/blob/master/examples/extending_tensorflow/layers.py

Bulit-in Ops,连同 TensorFlow 使用 TFLearn built-in 操作:

https://github.com/tflearn/tflearn/blob/master/examples/extending_tensorflow/builtin_ops.py

Summaries,连同 TensorFlow 使用 TFLearn summarizers:

https://github.com/tflearn/tflearn/blob/master/examples/extending_tensorflow/summaries.py

Variables,连同 TensorFlow 使用 TFLearn Variables:

https://github.com/tflearn/tflearn/blob/master/examples/extending_tensorflow/variables.py

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 158,425评论 4 361
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,058评论 1 291
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 108,186评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,848评论 0 204
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,249评论 3 286
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,554评论 1 216
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,830评论 2 312
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,536评论 0 197
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,239评论 1 241
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,505评论 2 244
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,004评论 1 258
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,346评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,999评论 3 235
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,060评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,821评论 0 194
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,574评论 2 271
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,480评论 2 267

推荐阅读更多精彩内容