SlideShare una empresa de Scribd logo
1 de 18
Descargar para leer sin conexión
チームfesta 
@datafesta 品川インターシティー10F 
https://sites.google.com/site/datafestjp/home 
2014年10月5日(日) 
片岡豊 + 太田博三
目次 
1.Bank Marketing data Setの選定理由とその内容 
2.本日の仮説とゴール 
2.1 3段論法:A→ B, B→C, A→C, A→C 
A: age, B: campaign, C: y(定期預金の有無) 
2.2 回帰モデル 
3.全説明変数の投入とbackward induction 
4. モデルの考察 
4.1 モデルの選択とAIC基準←科学的なアプローチ 
4.2 の人間的な解釈 
5.まとめ 
付録:コード 
2
1. Bank Marketing data Setの選定理由とその内容 
•マーケティングに興味があったため 
•モデルを構築したい 
•自分たちが認識できるデータだったから 
cf. 犯罪データは同じような変数が多かったから 
cf. ロンドンオリンピックのtweetデータで自然言 
語処理しようとしたが、重すぎて断念! 
3
1.Bank Marketing Data Set 
•# bank client data: 1 - age (numeric) 2 - job : type of job 3 - marital : marital status 4 - education 5 - default 6 - housing 7 - loan: 8 - contact 9 - month 10 - day_of_week 11 - duration: 12 - campaign 13 - pdays 14 - previous 15 - poutcome 16 - emp.var.rate: employment variation rate - quarterly indicator (numeric) 17 - cons.price.idx: consumer price index - monthly indicator (numeric) 18 - cons.conf.idx: consumer confidence index - monthly indicator (numeric) 19 - euribor3m: euribor 3 month rate - daily indicator (numeric) 20 - nr.employed: number of employees - quarterly indicator (numeric) Output variable (desired target): 21 - y - has the client subscribed a term deposit? (binary: 'yes','no') 
4
1.Bank Marketing Data Set 
•Attribute Information: 
•Input variables: 1-20 
説明変数 # bank client data 
•Output variable (desired target):目的変数 21 - y - has the client subscribed a term deposit? (binary: 'yes','no') 
•https://archive.ics.uci.edu/ml/datasets/Bank+Marketing# 
5
1.Bank Marketing Data Set 
•Y = α1x1+ α2x2+ α3x3 + … + α20x20 + ξ 
•Y: y, 定期預金の申し込んでいるか 否か 
•https://archive.ics.uci.edu/ml/datasets/Bank+Marketing# 
6
2.本日の仮説とゴール 
2.1 3段論法:A→ B, B→C, A→C, A→C 
A: age, B: campaign(), C: y(定期預金) 
2.2 回帰モデル 
→定期預金を申し込んでいるか、否かに2値分 類したい。この要因を適切な説明変数で表した い。 
7
2.1 3段論法:A→ B, B→C, A→C, A→C 
ターゲット 
キャンペーン 
コンバージョン 
A: age 
B: campaign 
(bank telemarketing 
campaign) 
C: y(定期預金) 
8
2.1 3段論法:A→ B, B→C, A→C, A→C 
ターゲット 
キャンペーン 
コンバージョン 
A: age 
B: campaign 
(bank telemarketing 
campaign) 
C: y(定期預金) 
② 
③ 
① 
① 
② 
③ 
9
2.2 回帰モデルとデータ加工 
Y = α1x1+ α2x2+ α3x3 + … + α20x20 + ξ 
Y: y, 定期預金の申し込んでいるか否か 
[41121] no no yes yes yes yes yes yes yes no yes no yes no yes no no no yes no 
[41141] yes yes yes no no yes yes yes yes no no yes no yes no no yes no yes yes 
[41161] yes no no yes yes yes yes no no no no yes yes yes yes no no no yes no 
[41181] no yes no yes no no yes no 
Levels: no yes 
yy = y 
head(yy) 
yy = as.numeric(yy) 
yy = ifelse(yy==1, 0,yy) 
yy = ifelse(yy==2, 1,yy) 
tail(yy) 
data2$y = yy 
[41041] 1 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 
[41081] 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 0 1 
[41121] 0 0 1 1 1 1 1 1 1 0 1 0 1 0 1 0 0 0 1 0 1 1 1 0 0 1 1 1 1 0 0 1 0 1 0 0 1 0 1 1 
[41161] 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 0 0 1 0 1 0 0 1 0 
10
3.全説明変数の投入とbackward induction 
glm_result = glm(y ~., data=data2,family="binomial") 
glm_result 
stepAIC(glm_result) 
libglm_result2 <- stepAIC(glm_result) 
> glm_result = glm(y ~., data=data2,family="binomial") 
> glm_result 
Call: glm(formula = y ~ ., family = "binomial", data = data2) 
Coefficients: 
(Intercept) age 
-2.366e+02 1.966e-04 
jobblue-collar jobentrepreneur 
-2.347e-01 -1.780e-01 
jobhousemaid jobmanagement 
-2.432e-02 -5.614e-02 
jobretired jobself-employed 
2.858e-01 -1.578e-01 
Degrees of Freedom: 41187 Total (i.e. Null); 41135 Residual 
Null Deviance: 29000 
Residual Deviance: 17080 AIC: 17180 
11
4. モデルの考察 
4.1 モデルの選択と AIC基準←科学的な アプローチ 
→AICは数字に小さ い方がよい。 
4.2 の人間的な解釈 
→絞り込んだ後の説 明変数は、定性的に 見ても、有用であると 判断できるものだっ た。 
Step: AIC=17170.27 y ~ job + default + contact + month + day_of_week + duration + campaign + pdays + poutcome + emp.var.rate + cons.price.idx + cons.conf.idx + euribor3m + nr.employed Df Deviance AIC <none> 17094 17170 - nr.employed 1 17097 17171 - cons.conf.idx 1 17101 17175 - euribor3m 1 17101 17175 - campaign 1 17107 17181 - day_of_week 4 17117 17185 - pdays 1 17111 17185 - default 2 17117 17189 - job 11 17145 17199 - cons.price.idx 1 17168 17242 - contact 1 17169 17243 - poutcome 2 17184 17256 - emp.var.rate 1 17246 17320 - month 9 17658 17716 - duration 1 22724 22798 > 
12
4. モデルの考察 
4.1 モデルの選択とAIC基準←科学的なアプ ローチ 
→AICは数字に小さい方がよい。 
4.2 の人間的な解釈 
→絞り込んだ後の説明変数は、定性的に見て も、有用であると判断できるものだった。 
13
5.まとめ 
今回、説明変数を20個も投入したが、GLMは強 く、AIC基準で頑健性の高い、良いモデルが構 築できました。 
また、その内容も、解釈しやすく、実用的なモデ ルになったと考えております! 
14
Thanks a lot ! 
15
コード一覧 
#正解presentation 
data2 <- read.csv("bank-additional-full.csv",header=T,sep=";") 
head(data2) 
summary(data2) 
attach(data2) 
detach(data) 
head(age) 
plot(loan,age) 
#考察 
length(loan) 
plot(loan) 
plot(y,loan) 
plot(loan,y) 
par(mfrow=c(2,2)) #2行2列 描画面を2分割してヒストグラムを書く 
lm2 <- lm(as.numeric(y) ~ ., data=data2) 
plot(lm2) 
lm3 <- step(lm2) 
#AICは小さいほうが良い 
16
コード一覧 
// 
yy = y 
head(yy) 
yy = as.numeric(yy) 
yy = ifelse(yy==1, 0,yy) 
yy = ifelse(yy==2, 1,yy) 
tail(yy) 
data2$y = yy 
glm_result = glm(y ~., data=data2,family="binomial") 
glm_result 
length(yy) 
nrow(housing) 
head(data2) 
library(boot) 
library(MASS) 
stepAIC(glm_result) 
libglm_result2 <- stepAIC(glm_result) 
library(mvpart) 
tree_result <- rpart(y ~ .,data=data2,method="class") 
tree_result 
plot(tree_result,uniform=T,brach=0.4,margin=0.05) 
text(tree_result,use.n=T,all=T) 
library(rpart.plot) 
prp(tree_result, type=2, extra=102,nn=TRUE, fallen.leaves=TRUE, faclen=0, varlen=0,shadow.col="grey", branch.lty=3, cex = 1.2, split.cex=1.2,under.cex = 1.2) 
plotcp(tree_result) 
17
付録.Bank Marketing Data Set 
•Attribute Information: 
•Input variables: # bank client data: 1 - age (numeric) 2 - job : type of job (categorical: 'admin.','blue- collar','entrepreneur','housemaid','management','retired','self- employed','services','student','technician','unemployed','unknown') 3 - marital : marital status (categorical: 'divorced','married','single','unknown'; note: 'divorced' means divorced or widowed) 4 - education (categorical: 'basic.4y','basic.6y','basic.9y','high.school','illiterate','professional.course','university.degree','unknown') 5 - default: has credit in default? (categorical: 'no','yes','unknown') 6 - housing: has housing loan? (categorical: 'no','yes','unknown') 7 - loan: has personal loan? (categorical: 'no','yes','unknown') # related with the last contact of the current campaign: 8 - contact: contact communication type (categorical: 'cellular','telephone') 9 - month: last contact month of year (categorical: 'jan', 'feb', 'mar', ..., 'nov', 'dec') 10 - day_of_week: last contact day of the week (categorical: 'mon','tue','wed','thu','fri') 11 - duration: last contact duration, in seconds (numeric). Important note: this attribute highly affects the output target (e.g., if duration=0 then y='no'). Yet, the duration is not known before a call is performed. Also, after the end of the call y is obviously known. Thus, this input should only be included for benchmark purposes and should be discarded if the intention is to have a realistic predictive model. # other attributes: 12 - campaign: number of contacts performed during this campaign and for this client (numeric, includes last contact) 13 - pdays: number of days that passed by after the client was last contacted from a previous campaign (numeric; 999 means client was not previously contacted) 14 - previous: number of contacts performed before this campaign and for this client (numeric) 15 - poutcome: outcome of the previous marketing campaign (categorical:

Más contenido relacionado

Destacado

Personal Learning Networks: Digital Education
Personal Learning Networks: Digital EducationPersonal Learning Networks: Digital Education
Personal Learning Networks: Digital Educationburtoh
 
Od webcast-cloud-fraud final
Od webcast-cloud-fraud finalOd webcast-cloud-fraud final
Od webcast-cloud-fraud finalOracleIDM
 
Stepping Towards Self Sufficiency: An Indigenous Economic Development Plan fo...
Stepping Towards Self Sufficiency: An Indigenous Economic Development Plan fo...Stepping Towards Self Sufficiency: An Indigenous Economic Development Plan fo...
Stepping Towards Self Sufficiency: An Indigenous Economic Development Plan fo...Wayne Dunn
 
Huntingdon Fusion Techniques Introduction
Huntingdon Fusion Techniques IntroductionHuntingdon Fusion Techniques Introduction
Huntingdon Fusion Techniques Introductionmikedunnhft
 
Tecido adiposo e cartilaginoso
Tecido adiposo e cartilaginosoTecido adiposo e cartilaginoso
Tecido adiposo e cartilaginosobiomedunifil
 
On bueno iniziativa 996
On bueno iniziativa   996On bueno iniziativa   996
On bueno iniziativa 996Miguel Rosario
 
Kukier chaney-2005-effect of biosolids on phytoavailability of cd
Kukier chaney-2005-effect of biosolids on phytoavailability of cdKukier chaney-2005-effect of biosolids on phytoavailability of cd
Kukier chaney-2005-effect of biosolids on phytoavailability of cdDeirdre Bingman
 
Thoughts for 365 days
Thoughts for 365 daysThoughts for 365 days
Thoughts for 365 daysMb Narayanan
 
Interactive Reader + Foldable
Interactive Reader  + FoldableInteractive Reader  + Foldable
Interactive Reader + Foldablejmori1
 
Paisley Engaging young professionals in the agri food sector - strategies, le...
Paisley Engaging young professionals in the agri food sector - strategies, le...Paisley Engaging young professionals in the agri food sector - strategies, le...
Paisley Engaging young professionals in the agri food sector - strategies, le...futureagricultures
 

Destacado (15)

Personal Learning Networks: Digital Education
Personal Learning Networks: Digital EducationPersonal Learning Networks: Digital Education
Personal Learning Networks: Digital Education
 
Formato planeacion
Formato planeacionFormato planeacion
Formato planeacion
 
Od webcast-cloud-fraud final
Od webcast-cloud-fraud finalOd webcast-cloud-fraud final
Od webcast-cloud-fraud final
 
Stepping Towards Self Sufficiency: An Indigenous Economic Development Plan fo...
Stepping Towards Self Sufficiency: An Indigenous Economic Development Plan fo...Stepping Towards Self Sufficiency: An Indigenous Economic Development Plan fo...
Stepping Towards Self Sufficiency: An Indigenous Economic Development Plan fo...
 
Huntingdon Fusion Techniques Introduction
Huntingdon Fusion Techniques IntroductionHuntingdon Fusion Techniques Introduction
Huntingdon Fusion Techniques Introduction
 
Tecido adiposo e cartilaginoso
Tecido adiposo e cartilaginosoTecido adiposo e cartilaginoso
Tecido adiposo e cartilaginoso
 
For (;;)
For (;;)For (;;)
For (;;)
 
On bueno iniziativa 996
On bueno iniziativa   996On bueno iniziativa   996
On bueno iniziativa 996
 
Kukier chaney-2005-effect of biosolids on phytoavailability of cd
Kukier chaney-2005-effect of biosolids on phytoavailability of cdKukier chaney-2005-effect of biosolids on phytoavailability of cd
Kukier chaney-2005-effect of biosolids on phytoavailability of cd
 
Thoughts for 365 days
Thoughts for 365 daysThoughts for 365 days
Thoughts for 365 days
 
W.cholamjiak2
W.cholamjiak2W.cholamjiak2
W.cholamjiak2
 
Preghiera a San Michele Arcangelo E-book
Preghiera a  San Michele Arcangelo E-bookPreghiera a  San Michele Arcangelo E-book
Preghiera a San Michele Arcangelo E-book
 
Interactive Reader + Foldable
Interactive Reader  + FoldableInteractive Reader  + Foldable
Interactive Reader + Foldable
 
Paisley Engaging young professionals in the agri food sector - strategies, le...
Paisley Engaging young professionals in the agri food sector - strategies, le...Paisley Engaging young professionals in the agri food sector - strategies, le...
Paisley Engaging young professionals in the agri food sector - strategies, le...
 
Advantis Consulting Ltd 2011
Advantis Consulting Ltd 2011Advantis Consulting Ltd 2011
Advantis Consulting Ltd 2011
 

Similar a Datafesta 20141004_05

おしゃスタ@リクルート
おしゃスタ@リクルートおしゃスタ@リクルート
おしゃスタ@リクルートIssei Kurahashi
 
「世界モデル」と関連研究について
「世界モデル」と関連研究について「世界モデル」と関連研究について
「世界モデル」と関連研究についてMasahiro Suzuki
 
企業の中の経済学
企業の中の経済学企業の中の経済学
企業の中の経済学Yusuke Kaneko
 
ビジネス活用事例で学ぶデータサイエンス入門 #6
ビジネス活用事例で学ぶデータサイエンス入門 #6ビジネス活用事例で学ぶデータサイエンス入門 #6
ビジネス活用事例で学ぶデータサイエンス入門 #6you shimajiro
 
資格学校のトライアル申込者数
資格学校のトライアル申込者数資格学校のトライアル申込者数
資格学校のトライアル申込者数XICA
 
【卒業論文】特徴付加型敵対的生成ネットワークによる ファッションデザイン画像生成(Fashion Design Generation based on G...
【卒業論文】特徴付加型敵対的生成ネットワークによる ファッションデザイン画像生成(Fashion Design Generation based on G...【卒業論文】特徴付加型敵対的生成ネットワークによる ファッションデザイン画像生成(Fashion Design Generation based on G...
【卒業論文】特徴付加型敵対的生成ネットワークによる ファッションデザイン画像生成(Fashion Design Generation based on G...鬼木 渚沙
 
資格学校のトライアル申込
資格学校のトライアル申込資格学校のトライアル申込
資格学校のトライアル申込XICA
 
[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...
[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...
[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...Insight Technology, Inc.
 
[DL輪読会]Deep Face Recognition: A Survey
[DL輪読会]Deep Face Recognition: A Survey[DL輪読会]Deep Face Recognition: A Survey
[DL輪読会]Deep Face Recognition: A SurveyDeep Learning JP
 
応用情報・午後・ストラテジ系を解く(H26春)
応用情報・午後・ストラテジ系を解く(H26春)応用情報・午後・ストラテジ系を解く(H26春)
応用情報・午後・ストラテジ系を解く(H26春)higher_tomorrow
 
顧客データを基にしたHivemallによる成約率予測
顧客データを基にしたHivemallによる成約率予測顧客データを基にしたHivemallによる成約率予測
顧客データを基にしたHivemallによる成約率予測Classi.corp
 
SAP Inside Track Tokyo 2022 Deep Learning版Cash Applicationをやってみた
SAP Inside Track Tokyo 2022 Deep Learning版Cash ApplicationをやってみたSAP Inside Track Tokyo 2022 Deep Learning版Cash Applicationをやってみた
SAP Inside Track Tokyo 2022 Deep Learning版Cash ApplicationをやってみたShuntaro Oguri
 
NeurIPS'21参加報告 tanimoto_public
NeurIPS'21参加報告 tanimoto_publicNeurIPS'21参加報告 tanimoto_public
NeurIPS'21参加報告 tanimoto_publicAkira Tanimoto
 
Rによるemailコミュニケーションの可視化
Rによるemailコミュニケーションの可視化Rによるemailコミュニケーションの可視化
Rによるemailコミュニケーションの可視化銀平 御園生
 

Similar a Datafesta 20141004_05 (16)

おしゃスタ@リクルート
おしゃスタ@リクルートおしゃスタ@リクルート
おしゃスタ@リクルート
 
「世界モデル」と関連研究について
「世界モデル」と関連研究について「世界モデル」と関連研究について
「世界モデル」と関連研究について
 
企業の中の経済学
企業の中の経済学企業の中の経済学
企業の中の経済学
 
ビジネス活用事例で学ぶデータサイエンス入門 #6
ビジネス活用事例で学ぶデータサイエンス入門 #6ビジネス活用事例で学ぶデータサイエンス入門 #6
ビジネス活用事例で学ぶデータサイエンス入門 #6
 
資格学校のトライアル申込者数
資格学校のトライアル申込者数資格学校のトライアル申込者数
資格学校のトライアル申込者数
 
おしゃスタat銀座
おしゃスタat銀座おしゃスタat銀座
おしゃスタat銀座
 
Freee kintone 200205
Freee kintone 200205Freee kintone 200205
Freee kintone 200205
 
【卒業論文】特徴付加型敵対的生成ネットワークによる ファッションデザイン画像生成(Fashion Design Generation based on G...
【卒業論文】特徴付加型敵対的生成ネットワークによる ファッションデザイン画像生成(Fashion Design Generation based on G...【卒業論文】特徴付加型敵対的生成ネットワークによる ファッションデザイン画像生成(Fashion Design Generation based on G...
【卒業論文】特徴付加型敵対的生成ネットワークによる ファッションデザイン画像生成(Fashion Design Generation based on G...
 
資格学校のトライアル申込
資格学校のトライアル申込資格学校のトライアル申込
資格学校のトライアル申込
 
[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...
[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...
[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...
 
[DL輪読会]Deep Face Recognition: A Survey
[DL輪読会]Deep Face Recognition: A Survey[DL輪読会]Deep Face Recognition: A Survey
[DL輪読会]Deep Face Recognition: A Survey
 
応用情報・午後・ストラテジ系を解く(H26春)
応用情報・午後・ストラテジ系を解く(H26春)応用情報・午後・ストラテジ系を解く(H26春)
応用情報・午後・ストラテジ系を解く(H26春)
 
顧客データを基にしたHivemallによる成約率予測
顧客データを基にしたHivemallによる成約率予測顧客データを基にしたHivemallによる成約率予測
顧客データを基にしたHivemallによる成約率予測
 
SAP Inside Track Tokyo 2022 Deep Learning版Cash Applicationをやってみた
SAP Inside Track Tokyo 2022 Deep Learning版Cash ApplicationをやってみたSAP Inside Track Tokyo 2022 Deep Learning版Cash Applicationをやってみた
SAP Inside Track Tokyo 2022 Deep Learning版Cash Applicationをやってみた
 
NeurIPS'21参加報告 tanimoto_public
NeurIPS'21参加報告 tanimoto_publicNeurIPS'21参加報告 tanimoto_public
NeurIPS'21参加報告 tanimoto_public
 
Rによるemailコミュニケーションの可視化
Rによるemailコミュニケーションの可視化Rによるemailコミュニケーションの可視化
Rによるemailコミュニケーションの可視化
 

Más de 博三 太田

slide_LT_Chatgpt部_太田_20231118.pdf
slide_LT_Chatgpt部_太田_20231118.pdfslide_LT_Chatgpt部_太田_20231118.pdf
slide_LT_Chatgpt部_太田_20231118.pdf博三 太田
 
LT_Visual_Entailment_GPT-4V_20231021.pdf
LT_Visual_Entailment_GPT-4V_20231021.pdfLT_Visual_Entailment_GPT-4V_20231021.pdf
LT_Visual_Entailment_GPT-4V_20231021.pdf博三 太田
 
LanguChain_summarization_LT_20230415.pdf
LanguChain_summarization_LT_20230415.pdfLanguChain_summarization_LT_20230415.pdf
LanguChain_summarization_LT_20230415.pdf博三 太田
 
image_video_instagram_202212.pdf
image_video_instagram_202212.pdfimage_video_instagram_202212.pdf
image_video_instagram_202212.pdf博三 太田
 
EC_intro_ota_202212.pdf
EC_intro_ota_202212.pdfEC_intro_ota_202212.pdf
EC_intro_ota_202212.pdf博三 太田
 
EC_attribute_exstraction_20221122.pdf
EC_attribute_exstraction_20221122.pdfEC_attribute_exstraction_20221122.pdf
EC_attribute_exstraction_20221122.pdf博三 太田
 
EC_attribute_exstraction_20221122.pdf
EC_attribute_exstraction_20221122.pdfEC_attribute_exstraction_20221122.pdf
EC_attribute_exstraction_20221122.pdf博三 太田
 
Python nlp handson_20220225_v5
Python nlp handson_20220225_v5Python nlp handson_20220225_v5
Python nlp handson_20220225_v5博三 太田
 
LT_hannari python45th_20220121_2355
LT_hannari python45th_20220121_2355LT_hannari python45th_20220121_2355
LT_hannari python45th_20220121_2355博三 太田
 
Logics 18th ota_20211201
Logics 18th ota_20211201Logics 18th ota_20211201
Logics 18th ota_20211201博三 太田
 
Jsai2021 winter ppt_ota_20211127
Jsai2021 winter ppt_ota_20211127Jsai2021 winter ppt_ota_20211127
Jsai2021 winter ppt_ota_20211127博三 太田
 
2021年度 人工知能学会全国大会 第35回
2021年度 人工知能学会全国大会 第35回2021年度 人工知能学会全国大会 第35回
2021年度 人工知能学会全国大会 第35回博三 太田
 
Lt conehito 20210225_ota
Lt conehito 20210225_otaLt conehito 20210225_ota
Lt conehito 20210225_ota博三 太田
 
Seattle consultion 20200822
Seattle consultion 20200822Seattle consultion 20200822
Seattle consultion 20200822博三 太田
 
Syumai lt_mokumoku__20200807_ota
Syumai  lt_mokumoku__20200807_otaSyumai  lt_mokumoku__20200807_ota
Syumai lt_mokumoku__20200807_ota博三 太田
 
Lt syumai moku_mokukai_20200613
Lt syumai moku_mokukai_20200613Lt syumai moku_mokukai_20200613
Lt syumai moku_mokukai_20200613博三 太田
 
Online python data_analysis19th_20200516
Online python data_analysis19th_20200516Online python data_analysis19th_20200516
Online python data_analysis19th_20200516博三 太田
 
本当に言いたい事をくみ取って応答する対話システムの構築に向けて - 昨年(2019年度)の取り組み -
本当に言いたい事をくみ取って応答する対話システムの構築に向けて- 昨年(2019年度)の取り組み -本当に言いたい事をくみ取って応答する対話システムの構築に向けて- 昨年(2019年度)の取り組み -
本当に言いたい事をくみ取って応答する対話システムの構築に向けて - 昨年(2019年度)の取り組み -博三 太田
 
Thesis sigconf2019 1123_hiromitsu.ota
Thesis sigconf2019 1123_hiromitsu.otaThesis sigconf2019 1123_hiromitsu.ota
Thesis sigconf2019 1123_hiromitsu.ota博三 太田
 
Sigconf 2019 slide_ota_20191123
Sigconf 2019 slide_ota_20191123Sigconf 2019 slide_ota_20191123
Sigconf 2019 slide_ota_20191123博三 太田
 

Más de 博三 太田 (20)

slide_LT_Chatgpt部_太田_20231118.pdf
slide_LT_Chatgpt部_太田_20231118.pdfslide_LT_Chatgpt部_太田_20231118.pdf
slide_LT_Chatgpt部_太田_20231118.pdf
 
LT_Visual_Entailment_GPT-4V_20231021.pdf
LT_Visual_Entailment_GPT-4V_20231021.pdfLT_Visual_Entailment_GPT-4V_20231021.pdf
LT_Visual_Entailment_GPT-4V_20231021.pdf
 
LanguChain_summarization_LT_20230415.pdf
LanguChain_summarization_LT_20230415.pdfLanguChain_summarization_LT_20230415.pdf
LanguChain_summarization_LT_20230415.pdf
 
image_video_instagram_202212.pdf
image_video_instagram_202212.pdfimage_video_instagram_202212.pdf
image_video_instagram_202212.pdf
 
EC_intro_ota_202212.pdf
EC_intro_ota_202212.pdfEC_intro_ota_202212.pdf
EC_intro_ota_202212.pdf
 
EC_attribute_exstraction_20221122.pdf
EC_attribute_exstraction_20221122.pdfEC_attribute_exstraction_20221122.pdf
EC_attribute_exstraction_20221122.pdf
 
EC_attribute_exstraction_20221122.pdf
EC_attribute_exstraction_20221122.pdfEC_attribute_exstraction_20221122.pdf
EC_attribute_exstraction_20221122.pdf
 
Python nlp handson_20220225_v5
Python nlp handson_20220225_v5Python nlp handson_20220225_v5
Python nlp handson_20220225_v5
 
LT_hannari python45th_20220121_2355
LT_hannari python45th_20220121_2355LT_hannari python45th_20220121_2355
LT_hannari python45th_20220121_2355
 
Logics 18th ota_20211201
Logics 18th ota_20211201Logics 18th ota_20211201
Logics 18th ota_20211201
 
Jsai2021 winter ppt_ota_20211127
Jsai2021 winter ppt_ota_20211127Jsai2021 winter ppt_ota_20211127
Jsai2021 winter ppt_ota_20211127
 
2021年度 人工知能学会全国大会 第35回
2021年度 人工知能学会全国大会 第35回2021年度 人工知能学会全国大会 第35回
2021年度 人工知能学会全国大会 第35回
 
Lt conehito 20210225_ota
Lt conehito 20210225_otaLt conehito 20210225_ota
Lt conehito 20210225_ota
 
Seattle consultion 20200822
Seattle consultion 20200822Seattle consultion 20200822
Seattle consultion 20200822
 
Syumai lt_mokumoku__20200807_ota
Syumai  lt_mokumoku__20200807_otaSyumai  lt_mokumoku__20200807_ota
Syumai lt_mokumoku__20200807_ota
 
Lt syumai moku_mokukai_20200613
Lt syumai moku_mokukai_20200613Lt syumai moku_mokukai_20200613
Lt syumai moku_mokukai_20200613
 
Online python data_analysis19th_20200516
Online python data_analysis19th_20200516Online python data_analysis19th_20200516
Online python data_analysis19th_20200516
 
本当に言いたい事をくみ取って応答する対話システムの構築に向けて - 昨年(2019年度)の取り組み -
本当に言いたい事をくみ取って応答する対話システムの構築に向けて- 昨年(2019年度)の取り組み -本当に言いたい事をくみ取って応答する対話システムの構築に向けて- 昨年(2019年度)の取り組み -
本当に言いたい事をくみ取って応答する対話システムの構築に向けて - 昨年(2019年度)の取り組み -
 
Thesis sigconf2019 1123_hiromitsu.ota
Thesis sigconf2019 1123_hiromitsu.otaThesis sigconf2019 1123_hiromitsu.ota
Thesis sigconf2019 1123_hiromitsu.ota
 
Sigconf 2019 slide_ota_20191123
Sigconf 2019 slide_ota_20191123Sigconf 2019 slide_ota_20191123
Sigconf 2019 slide_ota_20191123
 

Datafesta 20141004_05

  • 1. チームfesta @datafesta 品川インターシティー10F https://sites.google.com/site/datafestjp/home 2014年10月5日(日) 片岡豊 + 太田博三
  • 2. 目次 1.Bank Marketing data Setの選定理由とその内容 2.本日の仮説とゴール 2.1 3段論法:A→ B, B→C, A→C, A→C A: age, B: campaign, C: y(定期預金の有無) 2.2 回帰モデル 3.全説明変数の投入とbackward induction 4. モデルの考察 4.1 モデルの選択とAIC基準←科学的なアプローチ 4.2 の人間的な解釈 5.まとめ 付録:コード 2
  • 3. 1. Bank Marketing data Setの選定理由とその内容 •マーケティングに興味があったため •モデルを構築したい •自分たちが認識できるデータだったから cf. 犯罪データは同じような変数が多かったから cf. ロンドンオリンピックのtweetデータで自然言 語処理しようとしたが、重すぎて断念! 3
  • 4. 1.Bank Marketing Data Set •# bank client data: 1 - age (numeric) 2 - job : type of job 3 - marital : marital status 4 - education 5 - default 6 - housing 7 - loan: 8 - contact 9 - month 10 - day_of_week 11 - duration: 12 - campaign 13 - pdays 14 - previous 15 - poutcome 16 - emp.var.rate: employment variation rate - quarterly indicator (numeric) 17 - cons.price.idx: consumer price index - monthly indicator (numeric) 18 - cons.conf.idx: consumer confidence index - monthly indicator (numeric) 19 - euribor3m: euribor 3 month rate - daily indicator (numeric) 20 - nr.employed: number of employees - quarterly indicator (numeric) Output variable (desired target): 21 - y - has the client subscribed a term deposit? (binary: 'yes','no') 4
  • 5. 1.Bank Marketing Data Set •Attribute Information: •Input variables: 1-20 説明変数 # bank client data •Output variable (desired target):目的変数 21 - y - has the client subscribed a term deposit? (binary: 'yes','no') •https://archive.ics.uci.edu/ml/datasets/Bank+Marketing# 5
  • 6. 1.Bank Marketing Data Set •Y = α1x1+ α2x2+ α3x3 + … + α20x20 + ξ •Y: y, 定期預金の申し込んでいるか 否か •https://archive.ics.uci.edu/ml/datasets/Bank+Marketing# 6
  • 7. 2.本日の仮説とゴール 2.1 3段論法:A→ B, B→C, A→C, A→C A: age, B: campaign(), C: y(定期預金) 2.2 回帰モデル →定期預金を申し込んでいるか、否かに2値分 類したい。この要因を適切な説明変数で表した い。 7
  • 8. 2.1 3段論法:A→ B, B→C, A→C, A→C ターゲット キャンペーン コンバージョン A: age B: campaign (bank telemarketing campaign) C: y(定期預金) 8
  • 9. 2.1 3段論法:A→ B, B→C, A→C, A→C ターゲット キャンペーン コンバージョン A: age B: campaign (bank telemarketing campaign) C: y(定期預金) ② ③ ① ① ② ③ 9
  • 10. 2.2 回帰モデルとデータ加工 Y = α1x1+ α2x2+ α3x3 + … + α20x20 + ξ Y: y, 定期預金の申し込んでいるか否か [41121] no no yes yes yes yes yes yes yes no yes no yes no yes no no no yes no [41141] yes yes yes no no yes yes yes yes no no yes no yes no no yes no yes yes [41161] yes no no yes yes yes yes no no no no yes yes yes yes no no no yes no [41181] no yes no yes no no yes no Levels: no yes yy = y head(yy) yy = as.numeric(yy) yy = ifelse(yy==1, 0,yy) yy = ifelse(yy==2, 1,yy) tail(yy) data2$y = yy [41041] 1 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 [41081] 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 0 1 [41121] 0 0 1 1 1 1 1 1 1 0 1 0 1 0 1 0 0 0 1 0 1 1 1 0 0 1 1 1 1 0 0 1 0 1 0 0 1 0 1 1 [41161] 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 0 0 1 0 1 0 0 1 0 10
  • 11. 3.全説明変数の投入とbackward induction glm_result = glm(y ~., data=data2,family="binomial") glm_result stepAIC(glm_result) libglm_result2 <- stepAIC(glm_result) > glm_result = glm(y ~., data=data2,family="binomial") > glm_result Call: glm(formula = y ~ ., family = "binomial", data = data2) Coefficients: (Intercept) age -2.366e+02 1.966e-04 jobblue-collar jobentrepreneur -2.347e-01 -1.780e-01 jobhousemaid jobmanagement -2.432e-02 -5.614e-02 jobretired jobself-employed 2.858e-01 -1.578e-01 Degrees of Freedom: 41187 Total (i.e. Null); 41135 Residual Null Deviance: 29000 Residual Deviance: 17080 AIC: 17180 11
  • 12. 4. モデルの考察 4.1 モデルの選択と AIC基準←科学的な アプローチ →AICは数字に小さ い方がよい。 4.2 の人間的な解釈 →絞り込んだ後の説 明変数は、定性的に 見ても、有用であると 判断できるものだっ た。 Step: AIC=17170.27 y ~ job + default + contact + month + day_of_week + duration + campaign + pdays + poutcome + emp.var.rate + cons.price.idx + cons.conf.idx + euribor3m + nr.employed Df Deviance AIC <none> 17094 17170 - nr.employed 1 17097 17171 - cons.conf.idx 1 17101 17175 - euribor3m 1 17101 17175 - campaign 1 17107 17181 - day_of_week 4 17117 17185 - pdays 1 17111 17185 - default 2 17117 17189 - job 11 17145 17199 - cons.price.idx 1 17168 17242 - contact 1 17169 17243 - poutcome 2 17184 17256 - emp.var.rate 1 17246 17320 - month 9 17658 17716 - duration 1 22724 22798 > 12
  • 13. 4. モデルの考察 4.1 モデルの選択とAIC基準←科学的なアプ ローチ →AICは数字に小さい方がよい。 4.2 の人間的な解釈 →絞り込んだ後の説明変数は、定性的に見て も、有用であると判断できるものだった。 13
  • 14. 5.まとめ 今回、説明変数を20個も投入したが、GLMは強 く、AIC基準で頑健性の高い、良いモデルが構 築できました。 また、その内容も、解釈しやすく、実用的なモデ ルになったと考えております! 14
  • 15. Thanks a lot ! 15
  • 16. コード一覧 #正解presentation data2 <- read.csv("bank-additional-full.csv",header=T,sep=";") head(data2) summary(data2) attach(data2) detach(data) head(age) plot(loan,age) #考察 length(loan) plot(loan) plot(y,loan) plot(loan,y) par(mfrow=c(2,2)) #2行2列 描画面を2分割してヒストグラムを書く lm2 <- lm(as.numeric(y) ~ ., data=data2) plot(lm2) lm3 <- step(lm2) #AICは小さいほうが良い 16
  • 17. コード一覧 // yy = y head(yy) yy = as.numeric(yy) yy = ifelse(yy==1, 0,yy) yy = ifelse(yy==2, 1,yy) tail(yy) data2$y = yy glm_result = glm(y ~., data=data2,family="binomial") glm_result length(yy) nrow(housing) head(data2) library(boot) library(MASS) stepAIC(glm_result) libglm_result2 <- stepAIC(glm_result) library(mvpart) tree_result <- rpart(y ~ .,data=data2,method="class") tree_result plot(tree_result,uniform=T,brach=0.4,margin=0.05) text(tree_result,use.n=T,all=T) library(rpart.plot) prp(tree_result, type=2, extra=102,nn=TRUE, fallen.leaves=TRUE, faclen=0, varlen=0,shadow.col="grey", branch.lty=3, cex = 1.2, split.cex=1.2,under.cex = 1.2) plotcp(tree_result) 17
  • 18. 付録.Bank Marketing Data Set •Attribute Information: •Input variables: # bank client data: 1 - age (numeric) 2 - job : type of job (categorical: 'admin.','blue- collar','entrepreneur','housemaid','management','retired','self- employed','services','student','technician','unemployed','unknown') 3 - marital : marital status (categorical: 'divorced','married','single','unknown'; note: 'divorced' means divorced or widowed) 4 - education (categorical: 'basic.4y','basic.6y','basic.9y','high.school','illiterate','professional.course','university.degree','unknown') 5 - default: has credit in default? (categorical: 'no','yes','unknown') 6 - housing: has housing loan? (categorical: 'no','yes','unknown') 7 - loan: has personal loan? (categorical: 'no','yes','unknown') # related with the last contact of the current campaign: 8 - contact: contact communication type (categorical: 'cellular','telephone') 9 - month: last contact month of year (categorical: 'jan', 'feb', 'mar', ..., 'nov', 'dec') 10 - day_of_week: last contact day of the week (categorical: 'mon','tue','wed','thu','fri') 11 - duration: last contact duration, in seconds (numeric). Important note: this attribute highly affects the output target (e.g., if duration=0 then y='no'). Yet, the duration is not known before a call is performed. Also, after the end of the call y is obviously known. Thus, this input should only be included for benchmark purposes and should be discarded if the intention is to have a realistic predictive model. # other attributes: 12 - campaign: number of contacts performed during this campaign and for this client (numeric, includes last contact) 13 - pdays: number of days that passed by after the client was last contacted from a previous campaign (numeric; 999 means client was not previously contacted) 14 - previous: number of contacts performed before this campaign and for this client (numeric) 15 - poutcome: outcome of the previous marketing campaign (categorical: