랜덤포레스트(분류)를 이용하여 타이타닉 데이터를 예측하여 캐글에 제출
실습파일: 0704-titanic-ensemble-input


랜덤 포레스트 - 위키백과, 우리 모두의 백과사전 (wikipedia.org)
from sklearn.model_selection import RandomizedSearchCV
param_distributions = {"n_estimators" : np.random.randint(3,100,10),
"max_depth" : np.random.randint(100,1000,10)}
clf = RandomizedSearchCV(model, param_distributions=param_distributions,
n_iter=5, cv=5, n_jobs=-1, verbose=2, random_state=42)
clf.fit(X_train, y_train)
bestestimator
bestscore
cvresults
→데이터 프레임으로 : pd.DataFrame(clf.cvresults)
순서대로 나누어 주어야하는 데이터 : 시계열이 있는경우..
cross_validate 걸린시간과 스코어
cross_val_predict
분류와 회귀는 scoring 하는 방법이 다르다
# 학습(훈련)에 사용할 데이터셋 예) 시험의 기출문제
X_train = df.loc[df["count"].notnull(),feature_names]
X_train.shape
# 예측 데이터셋, 예) 실전 시험 문제
X_test = df.loc[df["count"].isnull(), feature_names]
X_test.shape
# 학습(훈련)에 사용할 정답값 예) 기출문제의 정답
Y_train = df.loc[df["count"].notnull(),label_name]
Y_train.shape
#df.loc[조건,열]
사실(Fact) : 랜덤포레스트(분류)를 이용하여 타이타닉 데이터를 예측, 랜 덤포레스트(회귀)를 이용하여 자전거 공유 수요 예측하여 캐글에 제출했다. 이 과정에서 배깅과 부트스트랩의 개념에 대해 알아보았다.
느낌(Feeling) : 수학적 개념이 나올수록 정신이 안드로메다로 가는중이다. 개념이 차곡차곡 쌓여야 하는데 막 들어오니 정신이 하나도 없다.
교훈(Finding) : 수학…… Aㅏ.. 자기전에 유튜브 좀 들어야겠다