LoginSignup
2
0

@kazuo_reve「「Rによる機械学習」の勉強履歴(1)」後追い: dockerで機械学習(77) with R (7)

Last updated at Posted at 2021-04-26

@kazuo_reve「Rによる機械学習」の勉強履歴(1)

の後追いをする。

本家

2019年度 データ分析勉強会
https://sites.google.com/site/kantometrics/archive/2019

で、すでにdockerに導入していたことを後で知る。
資料もなぜ8章までなのかも推測がついた。

残念なのは、ネットでの参加のための資料になっておらず、
特定の人たちの勉強会の資料を公開している点。

テストシンポジウムの発表原稿は、特定の人たちの勉強会の資料の域を超えていて、いろいろお世話になった。

Model Checking を適用した実践的非同期制御検証,Go with the Early Bird, 富士ゼロックス株式会社オフィスプロダクト事業本部コントローラソフトウェア開発部, 村石理恵/服部彰宏/野村秀樹/山本訓稔, 2007,
http://jasst.jp/archives/jasst07e/pdf/D2-3.pdf

ModelChecking 技術の専門性の排除とその効用, 富士ゼロックス株式会社オフィスプロダクト事業本部コントローラソフトウェア開発部, 野村秀樹/服部彰宏/村石理恵/山本訓稔,2008,
http://www.jasst.jp/archives/jasst08e/pdf/B4-2.pdf

作業記録

まずdockerで作業場を作る。作業記録はこちら。

今日のdocker error: RStudio (解決)
https://qiita.com/kaizen_nagoya/items/e1a757874e1e3e2c9765

起動方法

bash
docker run --rm -p 8787:8787 -e PASSWORD=yourpasswordhere rocker/rstudio

ブラウザを開いて、localhost:8787
でIDとpasswordの入力画面が出る。

IDはrstudio, ppasswordは、コマンドで指定したもの。

無事、ログインした。

R
R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

ログインしたら、ダウンロードしたい。
shellを走らせよう。

幸い、ログインの説明ページに、shell の走らせ方も載っていた。
やっぱRやってる人たちって、肝心なことがわかってるって感じ。

Using the rocker/rstudio container
https://hub.docker.com/r/rocker/rstudio

次に、別のコマンドから、

bash
$ docker exec -ti 0990b19a57db  bash

ログインした先で、

bash
# apt update; apt -y upgrade
# wget https://github.com/PacktPublishing/Machine-Learning-with-R-Third-Edition/archive/refs/heads/master.zip
# unzip master.zip

PacktPublishing/Machine-Learning-with-R-Third-Edition
https://github.com/PacktPublishing/Machine-Learning-with-R-Third-Edition

第二章のプログラムを動かそうとしたらエラーが出た。
gmodels.png

「tools」メニューからgmodelsをinstallすると、コマンドに命令が現れた。

> install.packages("gmodels")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘gtools’, ‘gdata’

trying URL 'https://packagemanager.rstudio.com/all/__linux__/focal/latest/src/contrib/gtools_3.8.2.tar.gz'
Content type 'binary/octet-stream' length 324517 bytes (316 KB)
==================================================
downloaded 316 KB

trying URL 'https://packagemanager.rstudio.com/all/__linux__/focal/latest/src/contrib/gdata_2.18.0.tar.gz'
Content type 'binary/octet-stream' length 1216305 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

trying URL 'https://packagemanager.rstudio.com/all/__linux__/focal/latest/src/contrib/gmodels_2.18.1.tar.gz'
Content type 'binary/octet-stream' length 111902 bytes (109 KB)
==================================================
downloaded 109 KB

* installing *binary* package ‘gtools’ ...
* DONE (gtools)
* installing *binary* package ‘gdata’ ...
* DONE (gdata)
* installing *binary* package ‘gmodels’ ...
* DONE (gmodels)

The downloaded source packages are in
	‘/tmp/RtmpX7KsLR/downloaded_packages’

「run」を押した。

bash
> # create vectors of data for three medical patients
> subject_name <- c("John Doe", "Jane Doe", "Steve Graves")

続きをしたいのでdocker hubに登録

bash
$ $ docker commit 0990b19a57db  kaizenjapan/rstudio
$ docker push kaizenjapan/rstudio
The push refers to repository [docker.io/kaizenjapan/rstudio]
955d73ad8db0: Pushed 
975f6564f91e: Mounted from rocker/rstudio 
904f4d5a6efd: Mounted from rocker/rstudio 
8e5e03028587: Mounted from rocker/rstudio 
9fbdaeca625e: Pushed 
346be19f13b0: Mounted from rocker/rstudio 
935f303ebf75: Mounted from rocker/rstudio 
0e64bafdc7ee: Mounted from rocker/rstudio 
latest: digest: sha256:751a292c52041f6643ec3328d84fc512a2ce6635128ac476c4546e07ab206176 size: 2000

第5章

R
> ## Understanding Decision Trees ----
> # calculate entropy of a two-class segment
> -0.60 * log2(0.60) - 0.40 * log2(0.40)
[1] 0.9709506

directory一覧

Machine-Learning-with-R-Cookbook-master
https://github.com/PacktPublishing/Machine-Learning-with-R-Cookbook

Machine-Learning-with-R-Cookbook-Second-Edition-master
https://github.com/PacktPublishing/Machine-Learning-with-R-Cookbook-Second-Edition

Machine-Learning-with-R-Quick-Start-Guide-master https://github.com/PacktPublishing/Machine-Learning-with-R-Quick-Start-Guide

Machine-Learning-with-R-Second-Edition-master
https://github.com/PacktPublishing/Machine-Learning-with-R-Second-Edition

Machine-Learning-with-R-Third-Edition-master
https://github.com/PacktPublishing/Machine-Learning-with-R-Third-Edition

4th editionは入れ物だけ存在。

参考資料(reference)

dockerで機械学習(76) with R (6)「Mastering Machine Learning with R 」By Cory Lesmeister
https://qiita.com/kaizen_nagoya/items/c3d51cdd3b811dac4d26

Rstudio入門
https://qiita.com/kaizen_nagoya/items/4f8bc5dd48cbc8d50329

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

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

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

Thank you very much for reading to the last sentence.

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

2
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
2
0