1.여러가지 모델
1. Random Forest
from sklearn.ensemble import RandomForestClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
X_columns=['Pclass','Sex','Age','Fare','Cabin','Embarked','Title','Family']
X_train,X_test,Y_train,Y_test=train_test_split(train[X_columns],train['Survived'],test_size=0.25,random_state=0)
clf=RandomForestClassifier(n_estimators=15,random_state=0)
clf.fit(X_train,Y_train)
from sklearn.metrics import accuracy_score
predicted=clf.predict(X_test)
accuracy=accuracy_score(Y_test,predicted)
accuracy
2. KNN
from sklearn.neighbors import KNeighborsClassifier
clf=KNeighborsClassifier(n_neighbors=10)
clf.fit(X_train,Y_train)
predicted=clf.predict(X_test)
accuracy=accuracy_score(Y_test,predicted)
accuracy
3. Logistic Regression
from sklearn.linear_model import LogisticRegression
logit=LogisticRegression()
logit.fit(X_train,Y_train)
predicted=logit.predict(X_test)
accuracy=accuracy_score(Y_test,predicted)
accuracy
4. SVC
from sklearn.svm import SVC
clf=SVC()
clf.fit(X_train,Y_train)
predicted=clf.predict(X_test)
accuracy=accuracy_score(Y_test,predicted)
accuracy
5. Disriminant
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
lda=LinearDiscriminantAnalysis()
lda.fit(X_train,Y_train)
predicted=lda.predict(X_test)
accuracy=accuracy_score(Y_test,predicted)
accuracy
2. 캐글 제출하기