text_plain_output_1.png
from sklearn.linear_model import LogisticRegression

import matplotlib.pyplot as plt

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

test_data = pd.read_csv('/kaggle/input/titanic/test.csv')
train_data = pd.read_csv('/kaggle/input/titanic/train.csv')

train_data.drop(['Calc_Age'], axis=1, inplace=True)

train_data.drop(['Calc_Fare'], axis=1, inplace=True)

train_data.dropna(subset=['Embarked'], inplace=True)

test_data.dropna(subset=['Embarked'], inplace=True)

X = train_data[['Pclass', 'Age', 'Fare', 'Sex', 'Embarked']]
y = train_data['Survived']

logmodel = LogisticRegression()
logmodel.fit(X_train, y_train)

predictions = logmodel.predict(X_test)

logmodel.score(X_train, y_train)

logmodel.score(X_test, y_test)

X_test = test_data[['Pclass', 'Age', 'Fare', 'Sex', 'Embarked']]
logmodel = LogisticRegression()
logmodel.fit(X, y)
predictions = logmodel.predict(X_test)