0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SIGNATEのタイタニック練習問題に挑戦

Posted at

初コンペ参加

SIGNATEのタイタニック生存予測に参加してみました。

# trainとtestの連結
data = pd.concat([train, test], sort=False)
# 欠損値の確認
data.isnull().sum()
# データ前処理
# sex
data['sex'].replace(['male','female'], [0, 1], inplace=True)

# embarked
data['embarked'].fillna(('S'), inplace=True)
data['embarked'] = data['embarked'].map( {'S': 0, 'C': 1, 'Q': 2} ).astype(int)

# age
data['age'].fillna(data['age'].median(), inplace=True)
# 学習データとテストデータの抽出
train = data[:len(train)]
test = data[len(train):]

y_train = train['survived']
X_train = train.drop('survived', axis = 1)
X_test = test.drop('survived', axis = 1)
# 機械学習
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC

clf = make_pipeline(StandardScaler(), SVC())
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
clf.score(X_train, y_train)

投稿した暫定評価は0.8005918でした
(この評価の見方もよく分かっていません)

初めて挑戦した感想

ChatGPTや書籍などを参考に挑戦したので、まだ完全に理解出来ていませんがこの問題をもう少し深掘りして理解を深めていきたいです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?