본문 바로가기
아이디어월드/스포츠 AI 베팅

6) 5일만에 스포츠 AI 베팅 만들기 : 문제점 발견 너무낮은 기대값 DAY3

by khalidpark 2022. 2. 9.

2일동안 프로젝트를 준비하면서 느낀 문제점

 

확률과 기대값의 상관관계
1.01 또는 1.02 배당률 성향만 투자하기에는 기대값이 너무 적다

10000원을 베팅해도 100원을 버니까

93번 적중하더라도 (운이좋게) , 1번 실패하면 손해인 게임이다

구체적인 기대값은 어떻게 될까?

https://blog.naver.com/mykepzzang/220607187232

 

[복권] 2. 로또 조작...? 왜 여러 명의 당첨자가 나올까?

* 이 글은 로또의 조작에 대해 확률적인 관점에서 쓴 글입니다. 그리고 로또가 조작이라고 의심된다면 객관...

blog.naver.com

https://blog.naver.com/mykepzzang/220609504848

 

[복권] 3. 로또 조작...? 1년 뒤 로또에 당첨될 확률은?

로또 조작...? 여러명의 당첨자Ƹ...

blog.naver.com

배당률 1.01 : 100 * 0.93 + -10000 * 0.07 = -699.07원

배당률 1.02 : 200 * 0.93 + -10000 * 0.07 = -698.14원


배당률갭에 따라 예측가능한 확률이 어느정도 되는지

또한

NBA 농구 데이터만 가지고 진행했었는데

KBL ,WKBL 농구 데이터와 남,여 배구 데이터도 합쳐서 데이터의 양을 키워서 진행해보자


target = 'RESULT'
df = pd.read_csv('/content/SPORTS DATA.csv')

df.head()

df = df[['TYPE','HOME TEAM','AWAY TEAM','HOME BET', 'AWAY BET','RESULT','BET GAP']]

df.head()

OVER_4 = df['BET GAP'] >= 4
OVER_3 = df['BET GAP'] >= 3
OVER_25 = df['BET GAP'] >= 2.5
OVER_2 = df['BET GAP'] >= 2
OVER_15 = df['BET GAP'] >= 1.5
OVER_1 = df['BET GAP'] >= 1

df4 = df[OVER_4]
df3 = df[OVER_3]
df25 = df[OVER_25]
df2 = df[OVER_2]
df15 = df[OVER_15]
df1 = df[OVER_1]

df3.head()

df2.head()

df4 = df4[['TYPE','HOME TEAM','AWAY TEAM','HOME BET', 'AWAY BET','RESULT']]
df3 = df3[['TYPE','HOME TEAM','AWAY TEAM','HOME BET', 'AWAY BET','RESULT']]
df25 = df25[['TYPE','HOME TEAM','AWAY TEAM','HOME BET', 'AWAY BET','RESULT']]
df2 = df2[['TYPE','HOME TEAM','AWAY TEAM','HOME BET', 'AWAY BET','RESULT']]
df15 = df15[['TYPE','HOME TEAM','AWAY TEAM','HOME BET', 'AWAY BET','RESULT']]
df1 = df1[['TYPE','HOME TEAM','AWAY TEAM','HOME BET', 'AWAY BET','RESULT']]

df3.head()

df2.head()

df3.dtypes

df2.dtypes

oe = OrdinalEncoder()
df4[['TYPE', 'HOME TEAM', 'AWAY TEAM']] = oe.fit_transform(df4.loc[:, ['TYPE', 'HOME TEAM', 'AWAY TEAM']])
df3[['TYPE', 'HOME TEAM', 'AWAY TEAM']] = oe.fit_transform(df3.loc[:, ['TYPE', 'HOME TEAM', 'AWAY TEAM']])
df25[['TYPE', 'HOME TEAM', 'AWAY TEAM']] = oe.fit_transform(df25.loc[:, ['TYPE', 'HOME TEAM', 'AWAY TEAM']])
df2[['TYPE', 'HOME TEAM', 'AWAY TEAM']] = oe.fit_transform(df2.loc[:, ['TYPE', 'HOME TEAM', 'AWAY TEAM']])
df15[['TYPE', 'HOME TEAM', 'AWAY TEAM']] = oe.fit_transform(df15.loc[:, ['TYPE', 'HOME TEAM', 'AWAY TEAM']])
df1[['TYPE', 'HOME TEAM', 'AWAY TEAM']] = oe.fit_transform(df1.loc[:, ['TYPE', 'HOME TEAM', 'AWAY TEAM']])


from sklearn.model_selection import train_test_split
train4, test4 = train_test_split(df4, train_size=0.85, test_size=0.15, 
                              stratify=df4[target], random_state=2)

from sklearn.model_selection import train_test_split
train3, test3 = train_test_split(df3, train_size=0.85, test_size=0.15, 
                              stratify=df3[target], random_state=2)

from sklearn.model_selection import train_test_split
train25, test25 = train_test_split(df25, train_size=0.85, test_size=0.15, 
                              stratify=df25[target], random_state=2)

from sklearn.model_selection import train_test_split
train2, test2 = train_test_split(df2, train_size=0.85, test_size=0.15, 
                              stratify=df2[target], random_state=2)

from sklearn.model_selection import train_test_split
train15, test15 = train_test_split(df15, train_size=0.85, test_size=0.15, 
                              stratify=df15[target], random_state=2)

from sklearn.model_selection import train_test_split
train1, test1 = train_test_split(df1, train_size=0.85, test_size=0.15, 
                              stratify=df1[target], random_state=2)

train3.shape, test3.shape

train2.shape, test2.shape

features = train4.drop(columns=[target]).columns

X_train4 = train4[features]
y_train4 = train4[target]
X_test4 = test4[features]
y_test4 = test4[target]

X_train3 = train3[features]
y_train3 = train3[target]
X_test3 = test3[features]
y_test3 = test3[target]

X_train25 = train25[features]
y_train25 = train25[target]
X_test25 = test25[features]
y_test25 = test25[target]

X_train2 = train2[features]
y_train2 = train2[target]
X_test2 = test2[features]
y_test2 = test2[target]

X_train15 = train15[features]
y_train15 = train15[target]
X_test15 = test15[features]
y_test15 = test15[target]

X_train1 = train1[features]
y_train1 = train1[target]
X_test1 = test1[features]
y_test1 = test1[target]

#XGBoost 사용
from xgboost import XGBClassifier

pipe4 = make_pipeline(
    XGBClassifier(n_estimators=200
                  , random_state=2
                  , n_jobs=-1
                  , max_depth=7
                  , learning_rate=0.2
                 )
)

pipe3 = make_pipeline(
    XGBClassifier(n_estimators=200
                  , random_state=2
                  , n_jobs=-1
                  , max_depth=7
                  , learning_rate=0.2
                 )
)
pipe25 = make_pipeline(
    XGBClassifier(n_estimators=200
                  , random_state=2
                  , n_jobs=-1
                  , max_depth=7
                  , learning_rate=0.2
                 )
)
pipe2 = make_pipeline(
    XGBClassifier(n_estimators=200
                  , random_state=2
                  , n_jobs=-1
                  , max_depth=7
                  , learning_rate=0.2
                 )
)

pipe15 = make_pipeline(
    XGBClassifier(n_estimators=200
                  , random_state=2
                  , n_jobs=-1
                  , max_depth=7
                  , learning_rate=0.2
                 )
)

pipe1 = make_pipeline(
    XGBClassifier(n_estimators=200
                  , random_state=2
                  , n_jobs=-1
                  , max_depth=7
                  , learning_rate=0.2
                 )
)

pipe4.fit(X_train4, y_train4);
pipe3.fit(X_train3, y_train3);
pipe25.fit(X_train25, y_train25);
pipe2.fit(X_train2, y_train2);
pipe15.fit(X_train15, y_train15);
pipe1.fit(X_train1, y_train1);


pipe3

pipe2

from sklearn.metrics import classification_report
# train 학습, 검증셋 정확도
print('배당률갭 4 이상 검증 정확도', pipe4.score(X_test4, y_test4))
print('배당률갭 3 이상 검증 정확도', pipe3.score(X_test3, y_test3))
print('배당률갭 2.5 이상 검증 정확도', pipe25.score(X_test25, y_test25))
print('배당률갭 2 이상 검증 정확도', pipe2.score(X_test2, y_test2))
print('배당률갭 1.5 이상 검증 정확도', pipe15.score(X_test15, y_test15))
print('배당률갭 1 이상 검증 정확도', pipe1.score(X_test1, y_test1))


배당률갭 2이상인 경기도 75%확률로 맞출수있다면 나쁘지 않은걸까?

검토를 하다가 조금 다른 방법으로 분석을 해봐야겠다는 생각을 했다.

728x90

댓글