Skip to content

Latest commit

 

History

History
102 lines (65 loc) · 5.9 KB

ch10_deeplearning.asciidoc

File metadata and controls

102 lines (65 loc) · 5.9 KB

Chapter 10: Introduction to Deep Learning

For this chapter, we will use deep learning to create QSAR models and generation models.

About deep learning

Neurons exist in the brain of an organism, and they form a network to transmit information, store and learn. The Artificial Neural Network (ANN) is a mathematical model of this network structure.

In general ANN, an input layer for inputting information for learning, an intermediate layer (or hidden layer) for learning a response (corresponding to the firing of a nerve synapse) based on a pattern of input information, and a third-layer or final output layer. However, deep learning enables highly accurate predictions by layering multiple hidden layers.

Although I will not explain this in this book in particular, if you want to write and understand the code from scratch yourself, Deep Learning from scratch can be helpful. Also, if you want to learn about theory properly, we recommend deep learning.

About TensorFlow and Keras

Tensorflow is a framework for machine learning developed by Google and released as OSS. It is often used mainly as a deep learning framework.

Note
Tensorflow has recently made a major update from 1.x to 2.x, but since the 2.x version has just appeared and there is little reference information, it uses the 1.x system. Also, since the API differs depending on the version of the same 1.x, if there is code you want to run, please be careful about which version is written.

Keras is a high-level API backed by a low-level framework such as Tensoflow, so you can write code more easily. Keras has been developed independently of Tensorflow, but recently Tensorflow comes with Keras. So you can use Keras without installing separately. The Tensorflow bundled version of Keras may not be the latest version of the home.

It’s annoying to decide which Keras to use, but for the sake of convenience, we will use Tensorflow-integrated Keras.

Relationship between Keras and Tensorflow

I will organize Keras and Tensoflow a little while referring to the official blog. Originally Keras was developed as a separate project from Tensoflow (and, of course, still), to use Keras, Tensorflow had to be installed. However, around the timing of the major version upgrade of Keras 2.x 2017, the Tensoflow project has integrated Keras. The English below is an excerpt of the above link. It is now possible to call Keras from Tensorflow.

TensorFlow integration Although Keras has supported TensorFlow as a runtime backend since December 2015, the Keras API had so far been kept separate from the TensorFlow codebase. This is changing: the Keras API will now become available directly as part of TensorFlow, starting with TensorFlow 1.2. This is a big step towards making TensorFlow accessible to its next million users.

Let’s install

Let’s install Tensorflow and Keras. When installing with anaconda, the package to be installed differs slightly depending on whether you use a GPU compatible version or a CPU version.

# CPU only
$ conda install -c conda-forge tensorflow
# GPU enabled
$ conda install -c anaconda tensorflow-gpu
Note
You can also use the pip command to install TensorFlow. In that case , please refer to the official document. But basically, if you make an environment with Conda, it is desirable to put a package with Conda.

Reference link

About Google colab

Google colab

Google colaboratory is a Jupyter notebook environment that can be run on the cloud. The framework for deep learning such as Theano, Thensorflow, Keras, Pytorch is already installed and time is limited, but because GPU can be used, it is very attractive that deep learning can be used without a GPU machine at hand is.

You need a Google account to use it, so if you do not have a Google account, it is a good idea to get an account at this opportunity. If you have a Google account, you can also run GitHub-style notebooks directly on Colab. Let’s open the Scikit-learn hands-on notebook previously used in Mishima.syk.

NOTE

It is a notebook created by @y__sama, but it is possible to learn from Auto data preparation to AutoSklearn.

First of all, go to Google colaboratory. If you do not get the screen below, please execute "Open Notebook" from "File" on the top left

GoogleColabTop

Next, click the tab named GitHub, copy and paste the following URL, and you can move the code from Jupyter Notebook.

GoogleColab2

When you open the notebook, you will see a screen similar to the Jupyter Notebook. You can execute the code of the cell with Shift + Return key.

NoteBook

To see the libraries available by default in Google Colab, type '! Pip freeze' in the cell and it will be listed.

  • absl-py==0.7.0

  • alabaster==0.7.12

  • snip ;)

  • yellowbrick==0.9.1

  • zict==0.1.3

  • zmq==0.0.0

Python deep learning framework

There are many Python deep learning frameworks. Mainly Theano, Tensorflow, Keras, MXNet, Chainer, PyTorch, etc.

Various deep learning documents often use one of the above frameworks for implementation. You may want to try it and choose a framework that is easy to use.