2016年4月2日土曜日

「Titanic: Machine Learning from Disaster」コンペ用データの取得方法、概要説明(Kaggleのタイタニック号沈没生存グループ予測チュートリアル)

KaggleのTitanicコンペのデータの取得先、データの説明は、
https://www.kaggle.com/c/titanic/data
にある。

 データを取得するには、コンペルールに承諾する必要がある(I understand and acceptを押す)。





ダウンロードできるファイルとその中身の概要は以下の通り。

File NameAvailable Formats
train(訳注:フォーマットは以下に記載。891人分。訓練データだろう。).csv (59.76 kb)
gendermodel(訳注:892-1309番目までの番号とSurvivedが0か1か。).csv (3.18 kb)
genderclassmodel(訳注:gendermodel.csvと同じ???).csv (3.18 kb)
test(訳注:892-1309番目までのtrain.csvと同じフォーマット。ただしSurvivedなし。これが問題、gendermodel.csvが答えだろう。).csv (27.96 kb)
gendermodel(訳注:未確認。確認後記載).py (3.58 kb)
genderclassmodel(訳注:未確認。確認後記載).py (5.63 kb)
myfirstforest(訳注:未確認。確認後記載).py (3.99 kb)


train.csvデータの概要は以下の通り。

※訳注:以下、青文字の訳注部分は、2016/4/2時点でダウンロードしたtrain.csvの中身を見てのデータ例。結構からっぽデータがあるのとキャビン、チケットのフォーマットが統一されていないのが注意が必要か。


図:train.csvの中身例
図:test.csvの中身例
図:gendermodel.csvの中身例
VARIABLE DESCRIPTIONS: survival Survival(生存したかどうか。0が死亡、1が生存。) (0 = No; 1 = Yes) pclass Passenger Class(船客のクラス。社会的地位。訳注:1,2,3のみで全部入っている様子。) (1 = 1st; 2 = 2nd; 3 = 3rd) name Name(名前) sex Sex(性別。※訳注:maleとfemale。) age Age(年齢。※訳注:からっぽあり。例:0.75、24.5) sibsp Number of Siblings/Spouses Aboard(乗船している兄弟姉妹、配偶者の数。訳注:全部入っている様子。整数。0-8) parch Number of Parents/Children Aboard(乗船している親あるいは子の数。訳注:全部入っている様子。整数。0-6) ticket Ticket Number(チケット番号。※訳注:フォーマットばらばら。例:A/5 21171、237736、STON/O2. 3101282など) fare Passenger Fare(乗船料金。※訳注:けっこういろいろ。例:8.4583、16.7。0~512少々) cabin Cabin(キャビンの種類。※訳注。からっぽあり。フォーマットばらばら。例:A5、C110、C23 C25 C27(←3つも入っていたりするものもある)、F G73(←なんだろこれ)) embarked Port of Embarkation(乗船した港名)※訳注:以下の3つのみ。少しだけ空っぽあり。実際の地図については、http://trevorstephens.com/post/72916401642/titanic-getting-started-with-r のサイトの頭のほうに分かりやすいものあり。 (C = Cherbourg; Q = Queenstown; S = Southampton) SPECIAL NOTES(注釈): Pclass is a proxy for socio-economic status (SES) (Pclassは社会的地位(SES)を示す。) 1st ~ Upper; 2nd ~ Middle; 3rd ~ Lower Age is in Years; Fractional if Age less than One (1) If the Age is Estimated, it is in the form xx.5(年齢が推測の場合、xx.5と記載。) With respect to the family relation variables (i.e. sibsp and parch) some relations were ignored. The following are the definitions used for sibsp and parch.(家族の関係を尊重するため、以下のように定義している。) Sibling: Brother, Sister, Stepbrother, or Stepsister of Passenger Aboard Titanic(乗船している兄弟、姉妹、義理の兄弟、義理の姉妹) Spouse: Husband or Wife of Passenger Aboard Titanic (Mistresses and Fiances Ignored)(夫、妻が乗船しているか。女主人(←?)、婚約中は除外。) Parent: Mother or Father of Passenger Aboard Titanic(父か母が乗船しているか) Child: Son, Daughter, Stepson, or Stepdaughter of Passenger Aboard Titanic(息子、娘、義理の息子、義理の娘が乗船しているか) Other family relatives excluded from this study include cousins, nephews/nieces, aunts/uncles, and in-laws. Some children travelled only with a nanny, therefore parch=0 for them. As well, some travelled with very close friends or neighbors in a village, however, the definitions do not support such relations.(いとこ、甥、姪、おじ、おばといったその他の親族は無視しています。乳母と一緒に乗船している子供については、parch(父母を示す)は0です。かなり親しい友達や隣人も、関係性としては記載していません。)


  ****以下、翻訳時点での記事コピー(元記事:https://www.kaggle.com/c/titanic/data)*****


VARIABLE DESCRIPTIONS:
survival        Survival
                (0 = No; 1 = Yes)
pclass          Passenger Class
                (1 = 1st; 2 = 2nd; 3 = 3rd)
name            Name
sex             Sex
age             Age
sibsp           Number of Siblings/Spouses Aboard
parch           Number of Parents/Children Aboard
ticket          Ticket Number
fare            Passenger Fare
cabin           Cabin
embarked        Port of Embarkation
                (C = Cherbourg; Q = Queenstown; S = Southampton)

SPECIAL NOTES:
Pclass is a proxy for socio-economic status (SES)
 1st ~ Upper; 2nd ~ Middle; 3rd ~ Lower

Age is in Years; Fractional if Age less than One (1)
 If the Age is Estimated, it is in the form xx.5

With respect to the family relation variables (i.e. sibsp and parch)
some relations were ignored.  The following are the definitions used
for sibsp and parch.

Sibling:  Brother, Sister, Stepbrother, or Stepsister of Passenger Aboard Titanic
Spouse:   Husband or Wife of Passenger Aboard Titanic (Mistresses and Fiances Ignored)
Parent:   Mother or Father of Passenger Aboard Titanic
Child:    Son, Daughter, Stepson, or Stepdaughter of Passenger Aboard Titanic

Other family relatives excluded from this study include cousins,
nephews/nieces, aunts/uncles, and in-laws.  Some children travelled
only with a nanny, therefore parch=0 for them.  As well, some
travelled with very close friends or neighbors in a village, however,
the definitions do not support such relations.

3 件のコメント:

  1. http://smrmkt.hatenablog.jp/entry/2013/01/04/192628
    に日本語での解説情報、どう推定するかなどの検討あり。

    返信削除
  2. http://smrmkt.hatenablog.jp/entry/2013/01/04/211844
    に船内見取り図へのリンクとか、クイーンズタウンで乗船した客の多くが3等客船だったとかの情報あり。船賃とか部屋番号とかを一般情報を用いてどう推測していくか。

    返信削除
  3. http://smrmkt.hatenablog.jp/entry/2013/01/06/164758
    データの欠損値の扱い方法。欠損値を含むデータの取り扱い方法には数種類の理論がある。ここでは年齢をどう扱えばよいのかの例としてRでMI(Multiple Imputation)を使って補完する方法について記載がある。RでFIMLを使って補完する方法については、続きの http://smrmkt.hatenablog.jp/entry/2013/01/14/141158 にある。

    返信削除