- 博客(7)
- 收藏
- 关注
原创 任务7.Titanic-模型融合
1.投票法from sklearn.ensemble import VotingClassifierdtc=DecisionTreeClassifier()svc = SVC(probability=True)rfc = RandomForestClassifier(n_estimators=10, criterion="entropy")lr = LogisticRegression(...
2019-01-13 17:37:35 253
原创 任务6. Titanic-模型调优
使用GridSearchCV来做格点搜索寻找最优参数调用库from sklearn.model_selection import GridSearchCVfrom sklearn.model_selection import StratifiedShuffleSplitfrom sklearn.pipeline import Pipelinefrom sklearn.model_sele...
2019-01-12 17:16:51 235
原创 任务5
首先调用所需要的库 from sklearn import metrics from sklearn.metrics import confusion_matrix from sklearn.metrics import precision_score from sklearn.metrics import recall_score ...
2019-01-10 20:36:17 164
原创 任务4模型构建之集成模型
1.随机森林from sklearn.ensemble import RandomForestClassifierrandom_forest = RandomForestClassifier(n_estimators=100)random_forest.fit(X_train, Y_train)Y_pred = random_forest.predict(X_test)acc_rando...
2019-01-08 19:43:26 226
原创 任务3.模型构建
之前任务中将训练集和测试集一起处理,数据处理完成后需要将训练集和测试集分离开来。前边并没有做过排序,因此顺序没有改变,直接取前891行就是训练集。#训练集:特征X_train = integDF_X.loc[:890,:]#训练集:标签Y_train = integDF.loc[:890,'Survived']#测试集:特征X_test = integDF_X.loc[891:,:]...
2019-01-07 18:28:45 254
原创 任务二:Titanic-特征工程
任务二:特征工程4.数据类型转换#性别转化为0,1sex_map={'male':1,'female':0}integDF['Sex'] = integDF['Sex'].map(sex_map)integDF['Sex'].head()#Embarked使用get_dummies进行one-hot编码,存放登船港口信息embarkedDf = pd.DataFrame()emb...
2019-01-06 19:40:44 458 1
原创 Titanic生还预测
1.导入数据import pandas as pdtrainDF=pd.read_csv('train.csv',encoding='gbk')testDF=pd.read_csv('test.csv',encoding='gbk')合并数据集,对两个数据集同时清洗integDF = pd.concat([trainDF,testDF],axis = 0,ignore_index = ...
2019-01-05 19:29:55 370
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人