在对 Titanic 数据集执行简单的拟合操作时。以下是我的代码:
data = pd.read_csv(r'.\Desktop\DS\Titanic\train.csv')
sex_train = data['Sex'].map({'male':0,'female':1})
survived_train = data['Survived']
sex_survivor_tree = GaussianNB()
sex_survivor_tree.fit(sex_train,survived_train)