分享

TensorFlow ML cookbook:前言

本帖最后由 levycui 于 2017-8-29 18:27 编辑
问题导读:
1、TensorFlow是什么?
2、这本书涵盖了什么内容?
3、谁合适阅读这本书?
4、如何下载示例代码?




2017-08-29_182642.jpg

前言
TensorFlow在2015年11月由Google开源,从此,它已经成为GitHub上最受欢迎的机器学习库。 TensorFlow的普及是由于创建计算图,自动区分和可定制性方法。由于这些功能,TensorFlow是一个非常强大和适应性强的工具,可用于解决许多不同的机器学习问题。
本书涉及许多机器学习算法,将其应用于实际情况和数据,并展示如何解释结果。

这本书涵盖了什么?
第1章, TensorFlow入门,介绍了TensorFlow的主要对象和概念。 我们引入tensors, variables, and placeholders。 还展示了如何使用TensorFlow中的矩阵和各种数学运算。 在本章末尾,我们将展示如何访问本书其余部分使用的数据源。

第2章,介绍TensorFlow如何以多种方式将第1章中的所有算法组件连接到计算图中,以创建简单的分类器。
这个过程中,我们涵盖了计算图,损失函数,反向传播和数据训练。

第3章,线性回归,重点是使用TensorFlow来探索各种线性回归技术,如Deming, lasso, ridge, elastic net, and logistic regression.。 展示了如何在TensorFlow计算图中实现它们。

第4章,支持向量机,引入了支持向量机(SVM),并展示了如何使用TensorFlow来实现线性SVM,非线性SVM和多类SVM。

第5章,最近邻方法,展示了如何使用数字度量,文本度量和缩放距离函数实现最近邻技术。 我们使用最近邻技术在地址之间执行记录匹配,并从MNIST数据库中分类手写数字。

第6章,神经网络,涵盖了如何在TensorFlow中实现神经网络,从操作入门和功能概念开始。 然后我们显示一个浅层神经网络,并展示如何建立各种不同类型的图层。 我们通过TensorFlow通过神经网络方法实践tic-tac-toe来结束本章。

第7章,自然语言处理,通过TensorFlow说明了各种文本处理技术。 我们展示如何实现bag-of-words技巧和TF-IDF文本。 然后,我们用CBOW和skip-gram引入神经网络文本表示,并将这些技术用于Word2Vec和Doc2Vec进行现实世界的预测。

第8章,卷积神经网络,通过说明如何在具有卷积神经网络(CNN)的图像上使用神经网络来扩展我们对神经网络的知识。
我们展示如何构建一个简单的CNN用于MNIST数字识别,并将其扩展到CIFAR-10任务彩色图像中。 我们还说明了如何扩展以前的训练过的图像识别模型,用于定制任务,我们通过解释和展示TensorFlow中的stylenet / neural风格和deep-dream算法来结束本章。

第9章,循环神经网络,解释了如何在TensorFlow中实现复发神经网络(RNN)。 我们展示如何做文本垃圾邮件预测,并扩展RNN模型,以基于莎士比亚的文本生成。 我们还训练序列到德文--英文翻译序列模型。 我们通过展示了Siamese RNN网络在地址上进行记录匹配的用法结束这一章。

第10章,采用TensorFlow进行生产,提供了将TensorFlow移植到生产环境中的提示和示例,以及如何利用多个处理设备(例如GPU)和在多台机器上设置分布式TensorFlow。

第11章,更多TensorFlow的内容,通过说明如何进行k均值,遗传算法和解决普通微分方程组(ODEs)来展示TensorFlow的多功能性。 我们还展示了Tensorboard的各种用途,以及如何查看计算图表度量。

学习这本书需要什么
本书中的实例使用TensorFlow,可从https://www.tensorflow.org获取基于Python 3,可从https://www.python.org/downloads/获得。
大多数实例将需要使用Internet连接下载必要的数据。

谁合适阅读这本书
TensorFlow Machine Learning Cookbook适用于具有机器学习经验的用户以及Python编程方面的经验。 具有广泛机器学习背景的用户可能会发现TensorFlow代码启发,具有广泛Python编程背景的用户可能会发现有助于解释。

章节
在这本书中,你会发现几个出现频率的标题(准备好了,怎么做...,它如何工作...,还有更多...,另见)。
要明确说明如何完成实例,我们使用以下部分:
  • 准备好
本节将告诉你实例中的期望,并介绍如何设置任何软件或实例所需的任何初步设置。
  • 怎么做…
本节包含遵循配方所需的步骤。
  • 怎么运行的…
本节通常包括上一节中发生的情况的详细说明。
  • 还有更多…
本节包括有关配方的附加信息,以使读者更了解实例。
  • 也可以看看
本部分提供了有关实例的其他有用信息的有用链接。

约定
在这本书中,有很多样式的文本区分信息的类型。
文本中的代码字如下所示:“然后我们设置batch_size变量”。 一个代码块设置如下:
[mw_shl_code=python,true]embedding_mat = tf.Variable(tf.random_uniform([vocab_size, embedding_size], -1.0, 1.0))
embedding_output = tf.nn.embedding_lookup(embedding_mat, x_data_ph)[/mw_shl_code]
一些代码块将具有与该代码相关联的输出,并且我们在代码块中注意如下:
[mw_shl_code=python,true]print('Training Accuracy: {}'.format(accuracy))[/mw_shl_code]
这导致以下输出:
[mw_shl_code=python,true]Training Accuracy: 0.878171[/mw_shl_code]
重要词语以粗体显示。

读者反馈
欢迎来自读者的反馈。 让我们知道你对这本书的看法 - 你喜欢或可能不喜欢的部分。 读者反馈对我们来说很重要,因为可以帮助我们写出对您来说收益的最大书籍。

要向我们发送反馈意见,只需将电子邮件发送至feedback@packtpub.com,并提供您的消息主题中的书名。
如果您需要一本书,并希望看到我们发布,请通过www.packtpub.com上的“SUGGEST A TITLE”表格或电子邮件suggest@packtpub.com向我们发送一条说明。
如果有一个话题,你有专业知识,你有兴趣写作或贡献一本书,请参阅我们的作者指南www.packtpub.com/authors

客户支持
既然您是Packt书的所有者,我们有许多事情可以帮助您从购买中获得最大收益。

下载示例代码
您可以从http://www.packtpub.com下载您购买的所有Packt图书的示例代码文件。 如果你在其他地方购买了这本书,你可以访问http://www.packtpub.com/support并注册以直接邮寄文件给你。
您可以按照以下步骤下载代码文件:
  • 使用您的电子邮件地址和密码登录或注册到我们的网站。
  • 将鼠标指针悬停在顶部的“支持”选项卡上。
  • 点击代码下载和错误。
  • 在搜索框中输入图书的名称。
  • 选择要下载代码文件的书。
  • 从您从这里购买这本书的下拉菜单中选择。
  • 点击代码下载。
文件下载后,请确保使用最新版本解压缩或解压缩文件夹:
WinRAR / 7-Zip for Windows
Zipeg / iZip / UnRarX for Mac
7-Zip / PeaZip for Linux

该书的代码包也由GitHub托管在https://github.com/PacktPublishi ... e-Learning-Cookbook上。 我们还拥有我们丰富的图书和视频目录中的其他代码包,网址为https://github.com/PacktPublishing/。 去看一下!
如果您使用Tableau Public,则需要找到已发布到Tableau Public的工作簿。 这些可以在以下链接找到:http://goo.gl/wJzfDO

虽然我们已经尽全力确保内容的准确性,但是错误确实会发生。
如果您在我们的某本书中发现错误,可能是文字或代码中的错误 - 如果您能向我们报告错误,我们将不胜感激。 通过这样做,您可以保障其他读者免受挫折,并帮助我们改进本书的后续版本。 如果您发现任何勘误表,请通过访问http://www.packtpub.com/submit-errata报告,选择您的图书,点击勘误表提交表单链接,并输入勘误表的详细信息。 一旦您的勘误获得验证,您的提交将被接受,勘误将被上传到我们的网站,或添加到该标题的勘误部分下的任何现有勘误表。
要查看以前提交的勘误表,请访问https://www.packtpub.com/books/content/support,并在搜索字段中输入图书的名称。 所需信息将显示在勘误部分下。

盗版行为
互联网上版权材料的盗版是所有媒体持续存在的问题。 在Packt,我们非常认真地保护我们的版权和许可。 如果您在互联网上以任何形式遇到我们的作品的非法副本,请立即提供我们的位置地址或网站名称,以便我们可以追求补救措施。
请通过copyright@packtpub.com与我们联系,告知可疑的盗版材料。
感谢您帮助我们保护作者,为您带来宝贵的内容。

问题
如果您对本书的任何方面有任何问题,可以通过以下方式与我们联系questions@packtpub.com,我们将尽全力解决问题。


原文:
Preface
TensorFlow was open sourced in November of 2015 by Google, and since then it has become the most starred machine learning repository on GitHub. TensorFlow's popularity is due to the approach of creating computational graphs, automatic differentiation, and customizability.Because of these features, TensorFlow is a very powerful and adaptable tool that can be used to solve many different machine learning problems.
This book addresses many machine learning algorithms, applies them to real situations and data, and shows how to interpret the results.

What this book covers
Chapter 1, Getting Started with TensorFlow, covers the main objects and concepts in
TensorFlow. We introduce tensors, variables, and placeholders. We also show how to work with matrices and various mathematical operations in TensorFlow. At the end of the chapter we show how to access the data sources used in the rest of the book.

Chapter 2,The TensorFlow Way, establishes how to connect all the algorithm components from Chapter 1 into a computational graph in multiple ways to create a simple classifier.
Along the way, we cover computational graphs, loss functions, back propagation, and training with data.

Chapter 3, Linear Regression, focuses on using TensorFlow for exploring various linear regression techniques, such as Deming, lasso, ridge, elastic net, and logistic regression. We show how to implement each in a TensorFlow computational graph.

Chapter 4, Support Vector Machines, introduces support vector machines (SVMs) and shows how to use TensorFlow to implement linear SVMs, non-linear SVMs, and multi-class SVMs.

Chapter 5, Nearest Neighbor Methods, shows how to implement nearest neighbor techniques using numerical metrics, text metrics, and scaled distance functions. We use nearest neighbor techniques to perform record matching among addresses and to classify hand-written digits from the MNIST database.

Chapter 6, Neural Networks, covers how to implement neural networks in TensorFlow, starting with the operational gates and activation function concepts. We then show a shallow neural network and show how to build up various different types of layers. We end the chapter by teaching TensorFlow to play tic-tac-toe via a neural network method.

Chapter 7, Natural Language Processing, illustrates various text processing techniques with TensorFlow. We show how to implement the bag-of-words technique and TF-IDF for text. We then introduce neural network text representations with CBOW and skip-gram and use these techniques for Word2Vec and Doc2Vec for making real-world predictions.

Chapter 8, Convolutional Neural Networks, expands our knowledge of neural networks by illustrating how to use neural networks on images with convolutional neural networks (CNNs).
We show how to build a simple CNN for MNIST digit recognition and extend it to color images in the CIFAR-10 task. We also illustrate how to extend prior trained image recognition models for custom tasks. We end the chapter by explaining and showing the stylenet/neural style and deep-dream algorithms in TensorFlow.

Chapter 9, Recurrent Neural Networks, explains how to implement recurrent neural networks(RNNs) in TensorFlow. We show how to do text-spam prediction, and expand the RNN model to do text generation based on Shakespeare. We also train a sequence to sequence model for German-English translation. We finish the chapter by showing the usage of Siamese RNN networks for record matching on addresses.

Chapter 10, Taking TensorFlow to Production, gives tips and examples on moving TensorFlow to a production environment and how to take advantage of multiple processing devices (for example GPUs) and setting up TensorFlow distributed on multiple machines.

Chapter 11, More with TensorFlow, show the versatility of TensorFlow by illustrating how to do k-means, genetic algorithms, and solve a system of ordinary differential equations (ODEs). We also show the various uses of Tensorboard, and how to view computational graph metrics.

What you need for this book
The recipes in this book use TensorFlow, which is available at https://www.tensorflow.org/ and are based on Python 3, available at https://www.python.org/downloads/.
Most of the recipes will require the use of an Internet connection to download the necessary data.

Who this book is for
The TensorFlow Machine Learning Cookbook is for users that have some experience with machine learning and some experience with Python programming. Users with an extensive machine learning background may find the TensorFlow code enlightening, and users with an extensive Python programming background may find the explanations helpful.

Sections
In this book, you will find several headings that appear frequently (Getting ready, How to do it…, How it works…, There's more…, and See also).
To give clear instructions on how to complete a recipe, we use these sections as follows:

  • Getting ready
This section tells you what to expect in the recipe, and describes how to set up any software or
any preliminary settings required for the recipe.
  • How to do it…
This section contains the steps required to follow the recipe.
  • How it works…
This section usually consists of a detailed explanation of what happened in the previous section.
  • There's more…
This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.
  • See also
This section provides helpful links to other useful information for the recipe.

Conventions
In this book, there are many styles of text that distinguish between the types of information.
Code words in text are shown as follows: "We then set the batch_size variable." A block of code is set as follows:
[mw_shl_code=python,true]embedding_mat = tf.Variable(tf.random_uniform([vocab_size, embedding_size], -1.0, 1.0))
embedding_output = tf.nn.embedding_lookup(embedding_mat, x_data_ph)[/mw_shl_code]

Some code blocks will have output associated with that code, and we note this in the code block as follows:
[mw_shl_code=python,true]print('Training Accuracy: {}'.format(accuracy))[/mw_shl_code]

Which results in the following output:
[mw_shl_code=python,true]Training Accuracy: 0.878171[/mw_shl_code]

Important words are shown in bold.

Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply drop an email to feedback@packtpub.com, and mention the book title in the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email suggest@packtpub.com.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
1. Log in or register to our website using your e-mail address and password.
2. Hover the mouse pointer on the SUPPORT tab at the top.
3. Click on Code Downloads & Errata.
4. Enter the name of the book in the Search box.
5. Select the book for which you're looking to download the code files.
6. Choose from the drop-down menu where you purchased this book from.
7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR / 7-Zip for Windows
Zipeg / iZip / UnRarX for Mac
7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/ PacktPublishing/TensorFlow-Machine-Learning-Cookbook. We also have other code bundles from our rich catalog of books and videos available at https://github.com/
PacktPublishing/. Check them out!
If you are using Tableau Public, you'll need to locate the workbooks that have been published to Tableau Public. These may be found at the following link: http://goo.gl/wJzfDO.

Although we have taken every care to ensure the accuracy of our content, mistakes do happen.
If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at copyright@packtpub.com with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions
If you have a problem with any aspect of this book, you can contact us at questions@packtpub.com, and we will do our best to address the problem.


本帖被以下淘专辑推荐:

已有(2)人评论

跳转到指定楼层
jianlei1109 发表于 2017-8-31 19:07:29
谢谢分享,学习了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条