application_vnd.jupyter.stderr_output_1.png
from sklearn.ensemble import GradientBoostingClassifier

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

train = pd.read_csv('/kaggle/input/titanic/train.csv')
test = pd.read_csv('/kaggle/input/titanic/test.csv')
target = train['Survived']
m = pd.DataFrame(test['PassengerId'])

import seaborn as sns
import matplotlib.pyplot as plt
dataset = pd.concat([train.drop('Survived', axis=1), test])
dataset.isnull().sum()

a = dataset.groupby('Pclass')['Age'].median()
dataset['Age'] = dataset['Age'].fillna(dataset['Pclass'].map(a))
a = dataset.groupby('Pclass')['Fare'].median()
dataset['Fare'] = dataset['Fare'].fillna(dataset['Pclass'].map(a))
dataset['Embarked'].fillna('S', inplace=True)

dataset['Name'].iloc[3].split()[1]
a = []
for i in range(len(dataset)):
    a.append(dataset['Name'].iloc[i].split()[1])
a = pd.Series(a)
dataset['Title'] = a

a = [i for i in dataset.columns if dataset[i].dtypes == 'object']
b = dataset[a]
for i in b.columns:
    dataset[i] = dataset[i].factorize()[0]
train = dataset[:len(train)]
test = dataset[len(train):]

from sklearn.ensemble import GradientBoostingClassifier
sky = GradientBoostingClassifier()
sky.fit(train, target)