ML modeling process
一、数据读取Load Data
二、数据分析EDA
三、数据预处理
四、特征工程Feature engineering
五、modeling & Tuning
六、Result
七、other theory
L1 or L2?
------------------------------------------------
一、数据读取Load Data
二、数据分析EDA
import matplotlib.pyplot as plt
import seaborn as sns
sns.stripplot() 分类散点图
sns.distplot() 直方图
sns.barplot() 条形图
sns.pairplot() 散点图矩阵
三、数据预处理
1.缺失值
2.离群值
3.标准化
数据的标准化是一个比较常用的数据预处理方法,其目的是处理不同量纲的数据,使其缩放到相同的数据区间和范围,以减少规模,特征、分布差异对模型的影响。标准化后的数据还具有了直接计算并生成符合指标的意义。
encoder = LabelEncoder()
encoder.fit_transform(train[your_feature + "_qbinned"].values.reshape(-1, 1)) : 归一化
np.round(train.loc[:, your_feature].values) : 标准化
数据的标准化:Z-score、Max-Min、MaxAbs、RobustScaler https://blog.csdn.net/weixin_37536446/article/details/81435461
from sklearn import preprocessing
#scaler = preprocessing.StandardScaler()
#scaler = preprocessing.MaxAbsScaler()
scaler = preprocessing.RobustScaler()
all_data.loc[:,numcols] = scaler.fit_transform(all_data[numcols])
4.降维技术
PCA 主成分分析 、factor analysis 因子分析 、ICA 独立成分分析 ,(KernelPCA、IncrementalPCA、Sparse PCA)
矩阵分解:SVD(奇异值分解)
四、特征工程Feature engineering
1.分箱:
pd.qcut(train.loc[:, your_feature].values,q=10,labels=False) : quantile based binning(基于分位数的分箱,等分)
卡方分箱
2.标准化
3.删掉高相关性变量
all_data.corr()
corr_matrix = all_data.corr().abs() #相关系数的绝对值
upper = corr_matrix.where(np.triu(np.ones(corr_matrix.shape), k=1).astype(np.bool))
to_drop = [c for c in upper.columns if any(upper[c] > 0.95)] #相关系数大于0.95的删掉
4.kmeans ,对自变量进行聚类
5.LDA ,线性判别分析
6.NB 朴素贝叶斯算法:GaussianNB ,BernoulliNB ,MultinomialNB
bnb = BernoulliNB(fit_prior=True)
bnb.fit(X_train, Y_train)
X_train_bnb = bnb.predict_log_proba(X_train)[:,1]
X_test_bnb = bnb.predict_log_proba(X_test)[:,1]
在scikit-learn中,一共有3个朴素贝叶斯的分类算法类。分别是GaussianNB,MultinomialNB和BernoulliNB。其中GaussianNB就是先验为高斯分布的朴
素贝叶斯,MultinomialNB就是先验为多项式分布的朴素贝叶斯,而BernoulliNB就是先验为伯努利分布的朴素贝叶斯。
https://www.cnblogs.com/pinard/p/6074222.html
7.LogisticRegression
8.SGDClassifier,梯度下降分类法
9.from sklearn.feature_selection import SelectKBest
10.Data augmentation 数据增强
数据增强程序 (数据增强就是过采样,此程序实现了对y=1的样本增加了2倍,对y=0的样本增加了1倍。中间对行数据进行了shuffle随机排列。)
五、modeling & tuning
5.1 modeling
LightGBM
GBDT
XGBoost
训练、测试样本的产生:Kfold、StratifiedKFold
GridSearch
5.2 Tuning 参数调优(精度、效率)
1.网络超参数自动化搜索 【调超参数】
Grid Search、Random Search、Heuristic Tuning启发式(手动调参)、
Automatic Hyperparameter Tuning 自动超参数调优(贝叶斯优化搜索、SMAC、TPE)
贝叶斯优化 https://www.cnblogs.com/marsggbo/p/9866764.html
https://www.cnblogs.com/marsggbo/p/10242962.html
2.最优化理论 【调模型参数】
BGD批量梯度下降、SGD随机梯度下降、MBGD小批量梯度下降 、
牛顿法、拟牛顿法、共轭梯度法
六、Result
roc curve / auc
ks
ML modeling process的更多相关文章
- Scoring and Modeling—— Underwriting and Loan Approval Process
https://www.fdic.gov/regulations/examinations/credit_card/ch8.html Types of Scoring FICO Scores V ...
- Threat Risk Modeling Learning
相关学习资料 http://msdn.microsoft.com/en-us/library/aa302419(d=printer).aspx http://msdn.microsoft.com/li ...
- 2016年美国数学建模比赛(MCM/ICM) E题环境科学 Are we heading towards a thirsty planet? 人工精准翻译。
第二次参加建模,觉得建模太有趣了,用几天的时间,迅速学习新知识,并解决实际问题. ——————————————————————————————————————————————————————————— ...
- UNIX标准及实现
UNIX标准及实现 引言 在UNIX编程环境和C程序设计语言的标准化方面已经做了很多工作.虽然UNIX应用程序在不同的UNIX操作系统版本之间进行移植相当容易,但是20世纪80年代UNIX版本 ...
- Data Visualization – Banking Case Study Example (Part 1-6)
python信用评分卡(附代码,博主录制) https://study.163.com/course/introduction.htm?courseId=1005214003&utm_camp ...
- PID控制器(比例-积分-微分控制器)- II
Table of Contents Practical Process Control Proven Methods and Best Practices for Automatic PID Cont ...
- UV mapping
[UV mapping] UV mapping is the 3D modeling process of making a 2D image representation of a 3D model ...
- kaggle Cross-Validation
The Cross-Validation Procedure In cross-validation, we run our modeling process on different subsets ...
- (翻译)2016美国数学建模MCM E题(环境)翻译:我们朝向一个干旱的星球?
PROBLEM E: Are we heading towards a thirsty planet? Will the world run out of clean water? According ...
随机推荐
- winform显示、隐藏任务栏及开始菜单
private const int SW_HIDE = 0; //隐藏 private const int SW_RESTORE = 9;//显示 /// <summary> /// 获取 ...
- MyBatis中foreach传入参数为数组
一.当只有一个参数,并且这个参数是数组时 接口方法的参数不需要添加@Param注释,collection="array" 示例 接口的方法 void deleteMulti(Str ...
- ubuntu 插网线无法上网解决方案
前言 不知道最近是什么情况,ubuntu链接网线总是上不去网,但是wifi还能用,一直也就没有捣鼓,不过今天连wifi都不能用了,只能开始修理了. 修复方案 使用ifconfig命令查看以太网的名称 ...
- java 单利模式设计原理,饿汉式懒汉式,开发中推荐饿汉式
单例模式的设计: 1 //Single类进内存,对象还没有存在,只有调用了getInstance方法时,才建立对象. //对象是方法被调用时,才初始化,也叫做对象的延时加载.成为:懒汉式. //Si ...
- Xcode7以后访问http加密
Xcode7 在Info.plist中add Row添加NSAppTransportSecurity类型Dictionary. 在NSAppTransportSecurity下添加NSAllowsAr ...
- python编程:从入门到实践----第六章:字典>练习
6-1 人:使用一个字典来存储一个熟人的信息,包括名.姓.年龄和居住的城市.该字典应包含键first_name .last_name .age 和city .将存储在该字典中的每项信息都打印出来. f ...
- unity学习 5.x依赖打包和解包
unity5已经封装好了接口,所以依赖打包并没有那么神秘和复杂了. 打包: 1.定义好资源的assetBundleName 2.BuildPipeline.BuildAssetBundles,指定资源 ...
- 剑指offer【12】- 二进制中1的个数
输入一个整数,输出该数二进制表示中1的个数.其中负数用补码表示. public class Solution { public int NumberOf1(int n) { String str = ...
- Linux分区挂载
Liunx采用树形的文件管理系统,也就是在Linux系统中,可以说已经没有分区的概念了.分区在Linux和其他设备一样都只是一个文件.要使用一个分区必须把它加载到文件系统中.这可能难于理解,继续往下看 ...
- idea快捷键(最常用)
--跳到上一空白行 ctrl+alt+enter --跳到下一空白行 shift+enter --为代码生成包裹快(try catch等) ctrl+alt+t --跳到某行 ctrl+g --实现父 ...