首页 > 其他分享 >Kaggle学习:A Journey through Titanic

Kaggle学习:A Journey through Titanic

时间:2022-12-08 12:00:47浏览次数:66  
标签:hue 变量 data Kaggle Journey through ax 数据 order


​https://kagglesds.blob.core.windows.net/script-versions/447794/notebook/__notebook__.ipynb?sv=2015-12-11&sr=b&sig=KfDPSVmALrMN7XeJ3j9GesHBJ8DP4qilENQX0byejtE%3D&se=2016-12-18T21%3A06%3A09Z&sp=r​



注意:

from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC, LinearSVC
from sklearn.ensemble import RandomForestClassifier


数据处理、特征工程:

函数学习:

pandas中的read_csv:读入csv文件。

info:列出csv数据文件中,各列的数据信息,包括数据名称、数量、类型。

drop([],axis=',inplace=True):丢掉数据中的某一列,inplace=True表示在源数据上修改,drop后原来的数据集改变。

fillna("x"):将缺失数据补齐为x。

fig, (axis1,axis2,axis3) = subplot(1,3,figsize=(15,5)):画一行三列子图,figsize表示图的大小。

countplot(x='',y='',hue="",data=,order=[,],ax=axisn):统计数量图,x,y轴变量,以hue线索来分割x轴每个数据,data是数据集,order是x轴变量的排序,ax表示子图号。

barplot(x='',y='',hue="",data=,order=[,],ax=axisn):画柱状图,x,y轴变量,以hue线索来分割x轴每个数据,data是数据集,order是x轴变量的排序,ax表示子图号。

factorplot(x='',y='',data=,kind='bar',order=[,],ax=axisn):根据两个维度画图,x,y轴变量,以hue线索来分割x轴每个数据,data是数据集,order是x轴变量的排序,ax表示子图号,kind表示图的种类。

get_dummies:把数据转换为指示变量。

mean:求均值。

std:求方差。

astype(int):将类型转换为int类型。

loc:索引一定条件的数据下标。

map:对列表中的元素迭代使用某函数。

apply:对数据元素进行某个操作。

seaborn.kdeplot(kernel density estimation)是核密度估计。核的作用是根据离散采样,估计连续密度分布。

pd.Series(logreg.coef_[0]):# get Correlation Coefficient for each feature using Logistic Regression


import sklearn.preprocessing as preprocessing

scaler = preprocessing.StandardScaler()

age_scale_param = scaler.fit(df['Age'])

归一化处理


对数据的操作:

1.对年龄求均值后加减方差的范围内求随机数。

2.补齐。

3.从训练数据集中看是否对结果影响,影响很小的特征直接drop.









标签:hue,变量,data,Kaggle,Journey,through,ax,数据,order
From: https://blog.51cto.com/u_15905340/5920889

相关文章