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 ...
随机推荐
- js对象属性名和属性值生成新数组时都作为属性值
const obj = { id:1, name:'zhangsan', age:18 } const arr = []; Object.getOwnPropertyNames(obj).forEac ...
- 吴裕雄--天生自然 JAVASCRIPT开发学习: 类型转换
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- 寒假day13
今天看了计算机网络的相关面试题
- [极客大挑战 2019]EasySQL
万能密码直接登陆得到flag admin' or 1=1 #
- ADS1.2 调试问题
最近一个程序需要用到ADS1.2这个软件,在使用过程中出现了如下问题: 1.由于以前用的是KEIL,所以没找到文件的工程,查资料才发现,这个工程文件打开的文件是MCP格式的文件: 2.调试的时候,没找 ...
- MAVEN报错Could not get the value for parameter compilerId for
Maven:Could not get the value for parameter compilerId for plugin execution default-compile..... 前两天 ...
- 31. docker swarm 通过 service 部署 wordpress
1. 创建 一个 overlay 的网络 driver docker network create -d overlay demo 查看网络列表 docker network ls 2. 创建mysq ...
- How to get AutoCAD Mtext content
#region 提取一个图层上的各类元素 [CommandMethod("BlockInLayerCAD")] public void BlockInLayerCAD() { Do ...
- php URL各部分获取方法(全局变量)
php URL各部分获取方法(全局变量),主要介绍php全局变量$_SERVER的用法,有需要的朋友,可以参考下. 1.$_SESSION['PHP_SELF'] - 获取当前正在执行脚本的文件名 2 ...
- Java8之深入理解Lambda
lambda表达式实战 从例子引出lambda 传递Runnable创建Thread java8之前 Thread thread=new Thread(new Runnable() { @Overri ...