MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_NextPart_01D0291F.6F7EA480" このドキュメントは単一ファイル Web ページ (Web アーカイブ ファイル) です。お使いのブラウザー、またはエディターは Web アーカイブ ファイルをサポートしていません。Windows? Internet Explorer? など、Web アーカイブをサポートするブラウザーをダウンロードしてください。 ------=_NextPart_01D0291F.6F7EA480 Content-Location: file:///C:/26838E51/db11.htm Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="shift_jis"
データベース特論資料 11 (Advanced Database Exercise=
11)
2015年1月5日
概要 Abstract
今日の授業では、データのビジュアライズに関する演習を行う.今日は、CSVファイルを使う.
Tod=
ay's
class is exercise on data visualization.
演習 11 (Exercises 11)
■ <=
/span>ステップ1
(Step 1) データファイルの準備 (prepare data files)
※昔の
C:\iris.csv が残っている場合には、新しい iris.csv で上書きしなさい
<=
span
lang=3DEN-US style=3D'mso-bidi-font-size:10.5pt;font-family:"Times New Roma=
n",serif'>
htt=
p://133.5.18.161/rinkou/addb/iris.csv と http://133.5.18.161/rinkou/addb=
/planets.csv
をダウンロードして、C:\iris.csv と
C:\planets.csv <=
span
style=3D'mso-bidi-font-size:10.5pt;font-family:"MS 明朝",serif;mso-ascii-=
font-family:
"Times New Roman";mso-fareast-font-family:"MS 明朝";mso-fareast-theme-fon=
t:minor-fareast;
mso-hansi-font-family:"Times New Roman";mso-bidi-font-family:"Times New Rom=
an"'>にコピー.
( If you can not use USB memory, o=
pen htt=
p://133.5.18.161/rinkou/addb/iris.csv
and http://133.5.18.161/rinkou/addb=
/planets.csv
using a Web browser, and copy it to C:\iris.csv
and C:\planets.csv)
◇
iris.csv (Microsoft Excel の画面)
◇
planets.csv (Microsoft Excel の画面)
■&n= bsp; ステップ2 (Step 2) Python のパッケージ seaborn のインストール (Install seaborn packaghe)<= o:p>
ステップ2を行うには、インターネット接続が必=
vである. いまインターネット接続ができない人=
ヘ、ステップ2以降を宿題とする (Internet connection is necess=
ary.
If you can not do internetc connection, the step 2 and later are your homew=
ork)=
1. Python のパッケージをインストールしたいので、IPython(sh)
を起動 (execute the
"IPython (sh)" to install python packages)
2. =
IPython(sh)
で次のコマンドを実行 (e=
xecute
the following commands in IPython(sh)'s console)
easy_install seaborn
※<=
/span> こ=
フコマンドを実行したときに、エラーメッセージが出た場合には、「=
pip
install seaborn」を実行=
<=
/span>
<実行結果の例の一部分>=
<=
/u>
ステップ5以降は、ステップ2が必要<=
/span>
■ <=
/span>ステップ3
(Step 3)
課題:以下の手順で Spyderの設定を行いなさい =
(Setup the Spyder software)
1.&n=
bsp;
Spyder の起動
(execute the Spyder)
&=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p;
2.&n=
bsp;
Interpreters で =
span>「Open an IPython Console<=
/b>」を選ぶ. (Select Interpreters, and Select =
gOpen
an IPython console”)
3.&n=
bsp;
「IPy=
thon
console」をクリック. (Click “IPython console”)
■ <=
/span>ステップ4
(Step 4)
CSVファイルを Pandasのデータフレームに格納する=
u> (read CSV file and store into =
Pandas
data frame)
1.
まず CSV<=
/span>ファイルのファイル名を確認する
(Examine the correct CSV file name)
<=
span
lang=3DEN-US style=3D'mso-bidi-font-size:10.5pt;font-family:"Times New Roma=
n",serif'>
以下、ファイル名が =
span>C:\planets.csv
と C:\iris.csv
であるとして説明を続ける
(In this exercise, the file =
names
are c:\planets.csv and c:\iris.csv)
2.
データフレームに CS=
Vファイルを読み込む. (read
CSV file into dataframe).
<=
span
lang=3DEN-US style=3D'mso-bidi-font-size:10.5pt;font-family:"Times New Roma=
n",serif'>
3.
planets の確認 (p=
rint
planets)
head() は先頭行の表示
('head()' is to print the top 5 lines)
<=
span
lang=3DEN-US style=3D'mso-bidi-font-size:10.5pt;font-family:"Times New Roma=
n",serif'>
4.
iris の確認 (p=
rint iris)
head() は先頭行の表示
('head()' is to print the top 5 lines)
<=
span
lang=3DEN-US style=3D'mso-bidi-font-size:10.5pt;font-family:"Times New Roma=
n",serif'>
■ <=
/span>ステップ5
(Step 5)
(1)
準備
(import packages)
(2)
相関行列 (correlation matrix)
=
各列間の相関係数が表示=
ウれる (correlation coefficients are displayed)
(3)
散布図 (scatter
plot)
◇ データフレーム:
planets, 列: distance, =
mass ※ number
を使って色付け
◇ データフレーム: planets, <=
/span>列:
distance, mass ※ number を使って色付け
◇ データフレーム: iris, 列:
petal_length, petal_width ※ species を使って色付け
(4)
ペア・プロット
(pair plot)
◇ データフレーム: iris
(5)
ヒストグラム (histogram)
◇ データフレーム: iris ※
species を使って色付け
<=
span
lang=3DEN-US style=3D'font-size:14.0pt;font-family:"Times New Roman",serif'=
>
◇ データフレーム:
planets, 列: year
 =
;
※ 横軸は 1985, 1986, …, 2014.縦横比は<=
/span> 2.5
◇ データフレーム:
planets, 列: year ※ number を使って色付け
 =
;
※ 横軸は 1985, 1986, …, 2014.縦横比は<=
/span> 2.5
<=
span
lang=3DEN-US style=3D'font-size:14.0pt;font-family:"Times New Roman",serif'=
>
◇ データフレーム: iris, 列: sepal_length
 = ; ※ 横軸は 4.0, 4.1, …, 7.9.縦横比は<= /span> 1.8
◇ データフレーム: iris, 列: sepal_length
※ species
を使って色付け
 = ; ※ 横軸は 4.0, 4.1, …, 7.9.縦横比は<= /span> 1.8
<=
/span>
(6) 1変数の分布 (Univariate distribution)
データの分= zや変化を可視化する. ヒストグラム,カーネル密度推定などを使用.
(Visualizing univariate distributions or time-changes using hi= stogram, kernel density estimation).
◇ データフレーム: planets,
列: year
=
◇ データフレーム: iris,
列: sepal_length
(7) 2変数の分布<=
/span>
(Bivariate distribution)
データの分= zや変化を可視化する. ヒストグラム,カーネル密度推定などを使用.
(Visualizing bivariate distributions using histogram, kernel d= ensity estimation).
◇ データフレーム: iris,
列: petal_length,
petal_width
=
=
=
演習シート 11 (Exercises S=
heet
11) 2015/1/5
氏名 専攻 = 学生番号
Name = &nb= sp; Department &= nbsp; &nbs= p; Student number =
記入して提出しなさい Fill out and submit
Q1<= span style=3D'mso-spacerun:yes'> ステップ1は終わった= ゥ 終わっていないか? Did you finish = the step 1 ?
□ はい Yes = □ いいえ No
Q2<= span style=3D'mso-spacerun:yes'> ステップ2は終わった= ゥ 終わっていないか? Did you finish = the step 2 ?
□ はい Yes = □ いいえ No
Q3<= span style=3D'mso-spacerun:yes'> ステップ3は終わった= ゥ 終わっていないか? Did you finish = the step 3 ?
□ はい Yes = □ いいえ No
Q4<= span style=3D'mso-spacerun:yes'> ステップ4は終わった= ゥ 終わっていないか? Did you finish = the step 4 ?
□ はい Yes = □ いいえ No
Q5<= span style=3D'mso-spacerun:yes'> ステップ5は終わった= ゥ 終わっていないか? Did you finish = the step 5 ?
□ はい Yes = □ いいえ No