LoginSignup
1
0

dockerで機械学習(73) with R (3)「RとKerasによるディープラーニング」François Chollet、J. J. Allaire 著

Last updated at Posted at 2018-10-14

1.すぐに利用したい方へ(as soon as)

「RとKerasによるディープラーニング」François Chollet、J. J. Allaire 著
picture_large978-4-87311-857-4.jpeg

<この項は書きかけです。順次追記します。>

docker

dockerを導入し、Windows, Macではdockerを起動しておいてください。
Windowsでは、BiosでIntel Virtualizationをenableにしないとdockerが起動しない場合があります。
また、セキュリティの警告などが出ることがあります。

##docker pull and run

$ docker pull kaizenjapan/r-sta

$ docker run -it kaizenjapan/r-sta /bin/bash

以下のshell sessionでは
(base) root@473fc1bb505d:/#は入力促進記号(comman prompt)です。実際には数字の部分が違うかもしれません。この行の#の右側を入力してください。
それ以外の行は出力です。出力にエラー、違いがあれば、コメント欄などでご連絡くださると幸いです。
それぞれの章のフォルダに移動します。

dockerの中と、dockerを起動したOSのシェルとが表示が似ている場合には、どちらで捜査しているか間違えることがあります。dockerの入力促進記号(comman prompt)に気をつけてください。

ファイル共有または複写

dockerとdockerを起動したOSでは、ファイル共有をするか、ファイル複写するかして、生成したファイルをブラウザ等表示させてください。参考文献欄にやり方のURLを記載しています。

複写の場合は、dockerを起動したOS側コマンドを実行しました。お使いのdockerの番号で置き換えてください。複写したファイルをブラウザで表示し内容確認しました。

2. dockerを自力で構築する方へ

ここから下は、上記のpullしていただいたdockerをどういう方針で、どういう手順で作ったかを記録します。
上記のdockerを利用する上での参考資料です。本の続きを実行する上では必要ありません。
自力でdocker/anacondaを構築する場合の手順になります。
dockerfileを作る方法ではありません。ごめんなさい。

docker

ubuntu, debianなどのLinuxを、linux, windows, mac osから共通に利用できる仕組み。
利用するOSの設定を変更せずに利用できるのがよい。
同じ仕様で、大量の人が利用することができる。
ソフトウェアの開発元が公式に対応しているものと、利用者が便利に仕立てたものの両方が利用可能である。今回は、公式に配布しているものを、自分で仕立てて、他の人にも利用できるようにする。

docker pull

docker公式配布の利用は、URLからpullすることで実現する。

apt

(base) root@473fc1bb505d:/# apt-get update

(base) root@473fc1bb505d:/# apt install -y procps

(base) root@473fc1bb505d:/# apt install -y vim

(base) root@473fc1bb505d:/# apt install -y apt-utils

(base) root@473fc1bb505d:/# apt install -y r-base

(base) root@473fc1bb505d:/# apt install -y r-cran-hmisc

wget

(base) root@9239fd07cbe8:/# wget https://manning-content.s3.amazonaws.com/download/1/faf36a8-8958-40db-8020-3f106794d8ed/source-code.zip
--2018-10-14 00:07:27--  https://manning-content.s3.amazonaws.com/download/1/faf36a8-8958-40db-8020-3f106794d8ed/source-code.zip
Resolving manning-content.s3.amazonaws.com (manning-content.s3.amazonaws.com)... 52.216.99.155
Connecting to manning-content.s3.amazonaws.com (manning-content.s3.amazonaws.com)|52.216.99.155|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 68634677 (65M) [application/zip]
Saving to: ‘source-code.zip’

source-code.zip        100%[===========================>]  65.46M  5.15MB/s    in 15s     

2018-10-14 00:07:43 (4.44 MB/s) - ‘source-code.zip’ saved [68634677/68634677]

(base) root@9239fd07cbe8:/# ls
ML_for_Hackers	dev   lib    mnt   root  source-code.zip		 sys  var
bin		etc   lib64  opt   run	 srv				 tmp
boot		home  media  proc  sbin  statistics-for-data-scientists  usr
(base) root@9239fd07cbe8:/# unzip source-code.zip 
Archive:  source-code.zip
51c5393bde914afa65141a8d13b80dc1322f5d6a
   creating: deep-learning-with-r-notebooks-master/
  inflating: deep-learning-with-r-notebooks-master/.gitignore  
 extracting: deep-learning-with-r-notebooks-master/.nojekyll  
  inflating: deep-learning-with-r-notebooks-master/LICENSE  
  inflating: deep-learning-with-r-notebooks-master/README.md  
  inflating: deep-learning-with-r-notebooks-master/cats_and_dogs_small_2.h5  
   creating: deep-learning-with-r-notebooks-master/notebooks/
  inflating: deep-learning-with-r-notebooks-master/notebooks/2.1-a-first-look-at-a-neural-network.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/2.1-a-first-look-at-a-neural-network.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/3.5-classifying-movie-reviews.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/3.5-classifying-movie-reviews.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/3.6-classifying-newswires.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/3.6-classifying-newswires.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/3.7-predicting-house-prices.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/3.7-predicting-house-prices.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/4.4-overfitting-and-underfitting.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/4.4-overfitting-and-underfitting.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/5.1-introduction-to-convnets.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/5.1-introduction-to-convnets.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/5.2-using-convnets-with-small-datasets.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/5.2-using-convnets-with-small-datasets.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/5.3-using-a-pretrained-convnet.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/5.3-using-a-pretrained-convnet.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/5.4-visualizing-what-convnets-learn.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/5.4-visualizing-what-convnets-learn.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/6.1-one-hot-encoding-of-words-or-characters.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/6.1-one-hot-encoding-of-words-or-characters.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/6.1-using-word-embeddings.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/6.1-using-word-embeddings.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/6.2-understanding-recurrent-neural-networks.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/6.2-understanding-recurrent-neural-networks.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/6.3-advanced-usage-of-recurrent-neural-networks.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/6.3-advanced-usage-of-recurrent-neural-networks.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/6.4-sequence-processing-with-convnets.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/6.4-sequence-processing-with-convnets.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/8.1-text-generation-with-lstm.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/8.1-text-generation-with-lstm.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/8.2-deep-dream.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/8.2-deep-dream.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/8.3-neural-style-transfer.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/8.3-neural-style-transfer.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/8.4-generating-images-with-vaes.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/8.4-generating-images-with-vaes.nb.html  
  inflating: deep-learning-with-r-notebooks-master/notebooks/8.5-introduction-to-gans.Rmd  
  inflating: deep-learning-with-r-notebooks-master/notebooks/8.5-introduction-to-gans.nb.html  
   creating: deep-learning-with-r-notebooks-master/notebooks/cat_activations/
  inflating: deep-learning-with-r-notebooks-master/notebooks/cat_activations/1_conv2d_21.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/cat_activations/2_max_pooling2d_21.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/cat_activations/3_conv2d_22.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/cat_activations/4_max_pooling2d_22.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/cat_activations/5_conv2d_23.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/cat_activations/6_max_pooling2d_23.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/cat_activations/7_conv2d_24.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/cat_activations/8_max_pooling2d_24.png  
   creating: deep-learning-with-r-notebooks-master/notebooks/dream/
 extracting: deep-learning-with-r-notebooks-master/notebooks/dream/at_scale_218x327x1.png  
 extracting: deep-learning-with-r-notebooks-master/notebooks/dream/at_scale_306x458x1.png  
 extracting: deep-learning-with-r-notebooks-master/notebooks/dream/at_scale_428x642x2.png  
 extracting: deep-learning-with-r-notebooks-master/notebooks/dream/at_scale_600x899x3.png  
 extracting: deep-learning-with-r-notebooks-master/notebooks/dream/final_dream.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/elephant_heatmap.png  
   creating: deep-learning-with-r-notebooks-master/notebooks/images/
  inflating: deep-learning-with-r-notebooks-master/notebooks/images/elephant_heatmap.png  
 extracting: deep-learning-with-r-notebooks-master/notebooks/images/elephant_overlay.png  
 extracting: deep-learning-with-r-notebooks-master/notebooks/images/polka_dots-r.png  
   creating: deep-learning-with-r-notebooks-master/notebooks/style_transfer/
  inflating: deep-learning-with-r-notebooks-master/notebooks/style_transfer/portrait.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/style_transfer/portrait_styled.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/style_transfer/transfer_style_reference.png  
   creating: deep-learning-with-r-notebooks-master/notebooks/vgg_filters/
  inflating: deep-learning-with-r-notebooks-master/notebooks/vgg_filters/block1_conv1.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/vgg_filters/block2_conv1.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/vgg_filters/block3_conv1.png  
  inflating: deep-learning-with-r-notebooks-master/notebooks/vgg_filters/block4_conv1.png  
(base) root@9239fd07cbe8:/# ls
ML_for_Hackers			       etc    mnt   sbin			    tmp
bin				       home   opt   source-code.zip		    usr
boot				       lib    proc  srv				    var
deep-learning-with-r-notebooks-master  lib64  root  statistics-for-data-scientists
dev				       media  run   sys
(base) root@9239fd07cbe8:/# cd deep-learning-with-r-notebooks-master/
(base) root@9239fd07cbe8:/deep-learning-with-r-notebooks-master# ls
LICENSE  README.md  cats_and_dogs_small_2.h5  notebooks

(base) root@782459e23422:/deep-learning-with-keras-ja/ch01# ls
__pycache__	   keras_MINST_V1_Sat_22_Sep_2018_04_48_41  keras_MINST_V2_Sat_22_Sep_2018_05_02_33  keras_MINST_V4.py	  requirements.txt
keras_MINST_V1.py  keras_MINST_V2.py			    keras_MINST_V3.py			     make_tensorboard.py  requirements_gpu.txt
(base) root@782459e23422:/deep-learning-with-keras-ja/ch01# pip install -r requirements.txt
Collecting keras==2.1.6 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/54/e8/eaff7a09349ae9bd40d3ebaf028b49f5e2392c771f294910f75bb608b241/Keras-2.1.6-py2.py3-none-any.whl (339kB)
    100% |████████████████████████████████| 348kB 1.2MB/s 
Collecting tensorflow==1.8.0 (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/22/c6/d08f7c549330c2acc1b18b5c1f0f8d9d2af92f54d56861f331f372731671/tensorflow-1.8.0-cp36-cp36m-manylinux1_x86_64.whl (49.1MB)
    100% |████████████████████████████████| 49.1MB 1.1MB/s 
Collecting h5py==2.7.1 (from -r requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/f2/b8/a63fcc840bba5c76e453dd712dbca63178a264c8990e0086b72965d4e954/h5py-2.7.1-cp36-cp36m-manylinux1_x86_64.whl (5.4MB)
    100% |████████████████████████████████| 5.4MB 6.5MB/s 
Requirement already satisfied: scipy>=0.14 in /opt/conda/lib/python3.6/site-packages (from keras==2.1.6->-r requirements.txt (line 1)) (1.1.0)
Requirement already satisfied: six>=1.9.0 in /opt/conda/lib/python3.6/site-packages (from keras==2.1.6->-r requirements.txt (line 1)) (1.11.0)
Requirement already satisfied: pyyaml in /opt/conda/lib/python3.6/site-packages (from keras==2.1.6->-r requirements.txt (line 1)) (3.13)
Requirement already satisfied: numpy>=1.9.1 in /opt/conda/lib/python3.6/site-packages (from keras==2.1.6->-r requirements.txt (line 1)) (1.15.1)
Requirement already satisfied: grpcio>=1.8.6 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (1.12.1)
Collecting tensorboard<1.9.0,>=1.8.0 (from tensorflow==1.8.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/59/a6/0ae6092b7542cfedba6b2a1c9b8dceaf278238c39484f3ba03b03f07803c/tensorboard-1.8.0-py3-none-any.whl (3.1MB)
    100% |████████████████████████████████| 3.1MB 9.8MB/s 
Requirement already satisfied: absl-py>=0.1.6 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (0.4.1)
Requirement already satisfied: protobuf>=3.4.0 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (3.6.0)
Requirement already satisfied: gast>=0.2.0 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (0.2.0)
Requirement already satisfied: termcolor>=1.1.0 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (1.1.0)
Requirement already satisfied: astor>=0.6.0 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (0.7.1)
Requirement already satisfied: wheel>=0.26 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (0.31.1)
Requirement already satisfied: markdown>=2.6.8 in /opt/conda/lib/python3.6/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->-r requirements.txt (line 2)) (2.6.11)
Collecting html5lib==0.9999999 (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/ae/ae/bcb60402c60932b32dfaf19bb53870b29eda2cd17551ba5639219fb5ebf9/html5lib-0.9999999.tar.gz (889kB)
    100% |████████████████████████████████| 890kB 9.8MB/s 
Requirement already satisfied: werkzeug>=0.11.10 in /opt/conda/lib/python3.6/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->-r requirements.txt (line 2)) (0.14.1)
Collecting bleach==1.5.0 (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/33/70/86c5fec937ea4964184d4d6c4f0b9551564f821e1c3575907639036d9b90/bleach-1.5.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /opt/conda/lib/python3.6/site-packages (from protobuf>=3.4.0->tensorflow==1.8.0->-r requirements.txt (line 2)) (40.2.0)
Building wheels for collected packages: html5lib
  Running setup.py bdist_wheel for html5lib ... done
  Stored in directory: /root/.cache/pip/wheels/50/ae/f9/d2b189788efcf61d1ee0e36045476735c838898eef1cad6e29
Successfully built html5lib
twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.
Installing collected packages: h5py, keras, html5lib, bleach, tensorboard, tensorflow
  Found existing installation: h5py 2.8.0
    Uninstalling h5py-2.8.0:
      Successfully uninstalled h5py-2.8.0
  Found existing installation: Keras 2.2.2
    Uninstalling Keras-2.2.2:
      Successfully uninstalled Keras-2.2.2
  Found existing installation: html5lib 1.0.1
    Uninstalling html5lib-1.0.1:
      Successfully uninstalled html5lib-1.0.1
  Found existing installation: bleach 2.1.4
    Uninstalling bleach-2.1.4:
      Successfully uninstalled bleach-2.1.4
  Found existing installation: tensorboard 1.9.0
    Uninstalling tensorboard-1.9.0:
      Successfully uninstalled tensorboard-1.9.0
  Found existing installation: tensorflow 1.9.0
    Uninstalling tensorflow-1.9.0:
      Successfully uninstalled tensorflow-1.9.0
Successfully installed bleach-1.5.0 h5py-2.7.1 html5lib-0.9999999 keras-2.1.6 tensorboard-1.8.0 tensorflow-1.8.0
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(base) root@782459e23422:/deep-learning-with-keras-ja/ch01# pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 8.0MB/s 
twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
Successfully installed pip-18.1
(base) root@782459e23422:/deep-learning-with-keras-ja/ch01# pip install -r requirements.txt
Requirement already satisfied: keras==2.1.6 in /opt/conda/lib/python3.6/site-packages (from -r requirements.txt (line 1)) (2.1.6)
Requirement already satisfied: tensorflow==1.8.0 in /opt/conda/lib/python3.6/site-packages (from -r requirements.txt (line 2)) (1.8.0)
Requirement already satisfied: h5py==2.7.1 in /opt/conda/lib/python3.6/site-packages (from -r requirements.txt (line 3)) (2.7.1)
Requirement already satisfied: scipy>=0.14 in /opt/conda/lib/python3.6/site-packages (from keras==2.1.6->-r requirements.txt (line 1)) (1.1.0)
Requirement already satisfied: six>=1.9.0 in /opt/conda/lib/python3.6/site-packages (from keras==2.1.6->-r requirements.txt (line 1)) (1.11.0)
Requirement already satisfied: pyyaml in /opt/conda/lib/python3.6/site-packages (from keras==2.1.6->-r requirements.txt (line 1)) (3.13)
Requirement already satisfied: numpy>=1.9.1 in /opt/conda/lib/python3.6/site-packages (from keras==2.1.6->-r requirements.txt (line 1)) (1.15.1)
Requirement already satisfied: absl-py>=0.1.6 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (0.4.1)
Requirement already satisfied: tensorboard<1.9.0,>=1.8.0 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (1.8.0)
Requirement already satisfied: grpcio>=1.8.6 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (1.12.1)
Requirement already satisfied: termcolor>=1.1.0 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (1.1.0)
Requirement already satisfied: protobuf>=3.4.0 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (3.6.0)
Requirement already satisfied: wheel>=0.26 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (0.31.1)
Requirement already satisfied: gast>=0.2.0 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (0.2.0)
Requirement already satisfied: astor>=0.6.0 in /opt/conda/lib/python3.6/site-packages (from tensorflow==1.8.0->-r requirements.txt (line 2)) (0.7.1)
Requirement already satisfied: werkzeug>=0.11.10 in /opt/conda/lib/python3.6/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->-r requirements.txt (line 2)) (0.14.1)
Requirement already satisfied: markdown>=2.6.8 in /opt/conda/lib/python3.6/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->-r requirements.txt (line 2)) (2.6.11)
Requirement already satisfied: html5lib==0.9999999 in /opt/conda/lib/python3.6/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->-r requirements.txt (line 2)) (0.9999999)
Requirement already satisfied: bleach==1.5.0 in /opt/conda/lib/python3.6/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->-r requirements.txt (line 2)) (1.5.0)
Requirement already satisfied: setuptools in /opt/conda/lib/python3.6/site-packages (from protobuf>=3.4.0->tensorflow==1.8.0->-r requirements.txt (line 2)) (40.2.0)
Description Notebook Source Code
2.1: A first look at a neural network Notebook (HTML) R Markdown (Rmd)
3.5: Classifying movie reviews: a binary classification example Notebook (HTML) R Markdown (Rmd)
3.6: Classifying newswires: a multi-class classification example Notebook (HTML) R Markdown (Rmd)
3.7: Predicting house prices: a regression example Notebook (HTML) R Markdown (Rmd)
4.4: Overfitting and underfitting Notebook (HTML) R Markdown (Rmd)
5.1: Introduction to convnets Notebook (HTML) R Markdown (Rmd)
5.2: Using convnets with small datasets Notebook (HTML) R Markdown (Rmd)
5.3: Using a pre-trained convnet Notebook (HTML) R Markdown (Rmd)
5.4: Visualizing what convnets learn Notebook (HTML) R Markdown (Rmd)
6.1: One-hot encoding of words or characters Notebook (HTML) R Markdown (Rmd)
6.1: Using word embeddings Notebook (HTML) R Markdown (Rmd)
6.2: Understanding recurrent neural networks Notebook (HTML) R Markdown (Rmd)
6.3: Advanced usage of recurrent neural networks Notebook (HTML) R Markdown (Rmd)
6.4: Sequence processing with convnets Notebook (HTML) R Markdown (Rmd)
8.1: Text generation with LSTM Notebook (HTML) R Markdown (Rmd)
8.2: Deep Dream Notebook (HTML) R Markdown (Rmd)
8.3: Neural style transfer Notebook (HTML) R Markdown (Rmd)
8.4: Generating images Notebook (HTML) R Markdown (Rmd)
8.5: Introduction to generative adversarial networks Notebook (HTML) R Markdown (Rmd)

brary(keras)
mnist <- dataset_mnist()
train_images <- mnist$train$x
train_labels <- mnist$train$y
test_images <- mnist$test$x
test_labels <- mnist$test$y

Error in library(keras) : there is no package called ‘keras’

install.packages("keras")
library(keras)
mnist <- dataset_mnist()
train_images <- mnist$train$x
train_labels <- mnist$train$y
test_images <- mnist$test$x
test_labels <- mnist$test$y

Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Error in contrib.url(repos, type) :
trying to use CRAN without setting a mirror

「ミラーを設定せずにCRANを使用しようとしています」というknitr文書でinstall.packagesが失敗する
https://code-examples.net/ja/q/2065380

install.packages("keras",repos = "http://cran.us.r-project.org")
library(keras)
mnist <- dataset_mnist()
train_images <- mnist$train$x
train_labels <- mnist$train$y
test_images <- mnist$test$x
test_labels <- mnist$test$y

(base) root@782459e23422:/deep-learning-with-r-notebooks-master/notebooks/work# r ch2.r
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘ps’, ‘glue’, ‘purrr’, ‘jsonlite’, ‘config’, ‘processx’, ‘rstudioapi’, ‘whisker’, ‘tidyselect’, ‘rlang’, ‘reticulate’, ‘tensorflow’, ‘tfruns’, ‘zeallot’, ‘R6’

trying URL 'http://cran.us.r-project.org/src/contrib/ps_1.1.0.tar.gz'
Content type 'application/x-gzip' length 242390 bytes (236 KB)

downloaded 236 KB

trying URL 'http://cran.us.r-project.org/src/contrib/glue_1.3.0.tar.gz'
Content type 'application/x-gzip' length 56368 bytes (55 KB)

downloaded 55 KB

trying URL 'http://cran.us.r-project.org/src/contrib/purrr_0.2.5.tar.gz'
Content type 'application/x-gzip' length 126147 bytes (123 KB)

downloaded 123 KB

trying URL 'http://cran.us.r-project.org/src/contrib/jsonlite_1.5.tar.gz'
Content type 'application/x-gzip' length 1096810 bytes (1.0 MB)

downloaded 1.0 MB

trying URL 'http://cran.us.r-project.org/src/contrib/config_0.3.tar.gz'
Content type 'application/x-gzip' length 12344 bytes (12 KB)

downloaded 12 KB

trying URL 'http://cran.us.r-project.org/src/contrib/processx_3.2.0.tar.gz'
Content type 'application/x-gzip' length 97959 bytes (95 KB)

downloaded 95 KB

trying URL 'http://cran.us.r-project.org/src/contrib/rstudioapi_0.8.tar.gz'
Content type 'application/x-gzip' length 47394 bytes (46 KB)

downloaded 46 KB

trying URL 'http://cran.us.r-project.org/src/contrib/whisker_0.3-2.tar.gz'
Content type 'application/x-gzip' length 27707 bytes (27 KB)

downloaded 27 KB

trying URL 'http://cran.us.r-project.org/src/contrib/tidyselect_0.2.5.tar.gz'
Content type 'application/x-gzip' length 21883 bytes (21 KB)

downloaded 21 KB

trying URL 'http://cran.us.r-project.org/src/contrib/rlang_0.2.2.tar.gz'
Content type 'application/x-gzip' length 325128 bytes (317 KB)

downloaded 317 KB

trying URL 'http://cran.us.r-project.org/src/contrib/reticulate_1.10.tar.gz'
Content type 'application/x-gzip' length 1709590 bytes (1.6 MB)

downloaded 1.6 MB

trying URL 'http://cran.us.r-project.org/src/contrib/tensorflow_1.9.tar.gz'
Content type 'application/x-gzip' length 47107 bytes (46 KB)

downloaded 46 KB

trying URL 'http://cran.us.r-project.org/src/contrib/tfruns_1.4.tar.gz'
Content type 'application/x-gzip' length 2008039 bytes (1.9 MB)

downloaded 1.9 MB

trying URL 'http://cran.us.r-project.org/src/contrib/zeallot_0.1.0.tar.gz'
Content type 'application/x-gzip' length 32549 bytes (31 KB)

downloaded 31 KB

trying URL 'http://cran.us.r-project.org/src/contrib/R6_2.3.0.tar.gz'
Content type 'application/x-gzip' length 30968 bytes (30 KB)

downloaded 30 KB

trying URL 'http://cran.us.r-project.org/src/contrib/keras_2.2.0.tar.gz'
Content type 'application/x-gzip' length 4903324 bytes (4.7 MB)

downloaded 4.7 MB

  • installing source package ‘ps’ ...
    ** package ‘ps’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -Wall px.c -o px
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c api-common.c -o api-common.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c common.c -o common.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c extra.c -o extra.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c dummy.c -o dummy.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c posix.c -o posix.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c api-posix.c -o api-posix.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c linux.c -o linux.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c api-linux.c -o api-linux.o
    gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o ps.so init.o api-common.o common.o extra.o dummy.o posix.o api-posix.o linux.o api-linux.o -L/usr/lib/R/lib -lR
    installing via 'install.libs.R' to /usr/local/lib/R/site-library/ps
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
  • DONE (ps)
  • installing source package ‘glue’ ...
    ** package ‘glue’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c glue.c -o glue.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c trim.c -o trim.o
    gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o glue.so glue.o init.o trim.o -L/usr/lib/R/lib -lR
    installing to /usr/local/lib/R/site-library/glue/libs
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    *** copying figures
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (glue)
  • installing source package ‘jsonlite’ ...
    ** package ‘jsonlite’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c base64.c -o base64.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c collapse_array.c -o collapse_array.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c collapse_object.c -o collapse_object.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c collapse_pretty.c -o collapse_pretty.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c escape_chars.c -o escape_chars.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c integer64_to_na.c -o integer64_to_na.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c is_datelist.c -o is_datelist.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c is_recordlist.c -o is_recordlist.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c is_scalarlist.c -o is_scalarlist.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c modp_numtoa.c -o modp_numtoa.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c null_to_na.c -o null_to_na.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c num_to_char.c -o num_to_char.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c parse.c -o parse.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c prettify.c -o prettify.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c push_parser.c -o push_parser.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c r-base64.c -o r-base64.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c register.c -o register.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c row_collapse.c -o row_collapse.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c transpose_list.c -o transpose_list.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c validate.c -o validate.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c yajl/yajl.c -o yajl/yajl.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c yajl/yajl_alloc.c -o yajl/yajl_alloc.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c yajl/yajl_buf.c -o yajl/yajl_buf.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c yajl/yajl_encode.c -o yajl/yajl_encode.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c yajl/yajl_gen.c -o yajl/yajl_gen.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c yajl/yajl_lex.c -o yajl/yajl_lex.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c yajl/yajl_parser.c -o yajl/yajl_parser.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c yajl/yajl_tree.c -o yajl/yajl_tree.o
    ar rcs libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
    gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o jsonlite.so base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -L. -lstatyajl -L/usr/lib/R/lib -lR
    installing to /usr/local/lib/R/site-library/jsonlite/libs
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (jsonlite)
  • installing source package ‘config’ ...
    ** package ‘config’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (config)
  • installing source package ‘rstudioapi’ ...
    ** package ‘rstudioapi’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (rstudioapi)
  • installing source package ‘whisker’ ...
    ** package ‘whisker’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
  • DONE (whisker)
  • installing source package ‘rlang’ ...
    ** package ‘rlang’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I./lib/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c capture.c -o capture.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I./lib/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c export.c -o export.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I./lib/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c internal.c -o internal.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I./lib/ -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c lib.c -o lib.o
    gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o rlang.so capture.o export.o internal.o lib.o -L/usr/lib/R/lib -lR
    installing to /usr/local/lib/R/site-library/rlang/libs
    ** R
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    *** copying figures
    ** building package indices
    ** testing if installed package can be loaded
  • DONE (rlang)
  • installing source package ‘zeallot’ ...
    ** package ‘zeallot’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (zeallot)
  • installing source package ‘R6’ ...
    ** package ‘R6’ successfully unpacked and MD5 sums checked
    ** R
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
  • DONE (R6)
  • installing source package ‘purrr’ ...
    ** package ‘purrr’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c backports.c -o backports.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c coerce.c -o coerce.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c extract.c -o extract.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c flatten.c -o flatten.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c map.c -o map.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c transpose.c -o transpose.o
    gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o purrr.so backports.o coerce.o extract.o flatten.o init.o map.o transpose.o -L/usr/lib/R/lib -lR
    installing to /usr/local/lib/R/site-library/purrr/libs
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    *** copying figures
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (purrr)
  • installing source package ‘processx’ ...
    ** package ‘processx’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -Wall tools/px.c -o tools/px
    gcc -std=gnu99 -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g supervisor/supervisor.c supervisor/utils.c
    -o supervisor/supervisor
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c poll.c -o poll.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c processx-connection.c -o processx-connection.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c processx-vector.c -o processx-vector.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c create-time.c -o create-time.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c unix/childlist.c -o unix/childlist.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c unix/connection.c -o unix/connection.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c unix/processx.c -o unix/processx.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c unix/sigchld.c -o unix/sigchld.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c unix/utils.c -o unix/utils.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c unix/named_pipe.c -o unix/named_pipe.o
    gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o processx.so init.o poll.o processx-connection.o processx-vector.o create-time.o unix/childlist.o unix/connection.o unix/processx.o unix/sigchld.o unix/utils.o unix/named_pipe.o -L/usr/lib/R/lib -lR
    installing via 'install.libs.R' to /usr/local/lib/R/site-library/processx
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
  • DONE (processx)
  • installing source package ‘reticulate’ ...
    ** package ‘reticulate’ successfully unpacked and MD5 sums checked
    ** libs
    g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
    g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c event_loop.cpp -o event_loop.o
    g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c libpython.cpp -o libpython.o
    g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c output.cpp -o output.o
    g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c python.cpp -o python.o
    g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c readline.cpp -o readline.o
    g++ -shared -L/usr/lib/R/lib -Wl,-z,relro -o reticulate.so RcppExports.o event_loop.o libpython.o output.o python.o readline.o -L/usr/lib/R/lib -lR
    installing to /usr/local/lib/R/site-library/reticulate/libs
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (reticulate)
  • installing source package ‘tidyselect’ ...
    ** package ‘tidyselect’ successfully unpacked and MD5 sums checked
    ** libs
    g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
    g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.3.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c combine_variables.cpp -o combine_variables.o
    g++ -shared -L/usr/lib/R/lib -Wl,-z,relro -o tidyselect.so RcppExports.o combine_variables.o -L/usr/lib/R/lib -lR
    installing to /usr/local/lib/R/site-library/tidyselect/libs
    ** R
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
  • DONE (tidyselect)
  • installing source package ‘tfruns’ ...
    ** package ‘tfruns’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (tfruns)
  • installing source package ‘tensorflow’ ...
    ** package ‘tensorflow’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
  • DONE (tensorflow)
  • installing source package ‘keras’ ...
    ** package ‘keras’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (keras)

The downloaded source packages are in
‘/tmp/downloaded_packages’
/opt/conda/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.

(base) root@782459e23422:/deep-learning-with-r-notebooks-master/notebooks/work# r ch2.r
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.us.r-project.org/src/contrib/keras_2.2.0.tar.gz'
Content type 'application/x-gzip' length 4903324 bytes (4.7 MB)

downloaded 4.7 MB

  • installing source package ‘keras’ ...
    ** package ‘keras’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (keras)

The downloaded source packages are in
‘/tmp/downloaded_packages’
/opt/conda/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.

参考文献(reference)

R ScriptやR Markdownからinstall.packages()を呼び出す場合はレポジトリを指定しないとエラーになる
https://qiita.com/maech/items/03b9566fb0fe940e1736

Rでtrying to use CRAN without setting a mirrorと言われたら
https://qiita.com/manabuishiirb/items/88fb9d5207e6802da4b7

<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>

文書履歴(document history)

ver. 0.10 初稿 20181014
ver. 0.11 番号変更,参考文献追記 20181028

最後までおよみいただきありがとうございました。

いいね 💚、フォローをお願いします。

Thank you very much for reading to the last sentence.

Please press the like icon 💚 and follow me for your happy life.

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0