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 ...
随机推荐
- (2)关于opencv解压
关于opencv解压,一定不能解压到你的C盘的 ProgramFile(x86)中,不然,你肯定不会成功,你要放在C盘的其他文件夹,或者是别的盘中 就是因为这一个错误,我弄了一天,哎哎,时间宝贵啊
- Ajax请求文件下载操作失败的原因和解决办法
使用Poi做excel表格导出功能,第一个想到的就是用Ajax来发送请求,但是Ajax和后台代码都执行了,就是无法下载文件. 前台代码 function exportExl(){ var form = ...
- python画图嵌入html
#-*- coding=utf-8 -*- import matplotlib import matplotlib.pyplot as plt from io import BytesIO impor ...
- 统计web 访问日志的请求数据
tomcat日志格式 在配置文件 server.xml 中,具体参照官方文档 https://tomcat.apache.org/tomcat-8.0-doc/config/valve.html#A ...
- MDK中在stm32下载出现error:flash download failed “cortex-m3”的问题
主要原因,以前用的是J-LINK ,现在用的是ST-LINK .MDK默认是J-LINK .所以在改了下载器.
- Ubuntu系统的软件源更换
参考:https://www.daweibro.com/node/142 什么是Ubuntu的软件源? 我们在使用Debian或者Ubuntu的apt-get工具来安装需要的软件时,其实就是从服务器获 ...
- 第22章 Makefile基础
一.自动处理头文件的依赖关系 在Makefile中插入如下代码: include $(sources:.c=.d) %.d: %.c set -e; rm -f $@; \ $(CC) -MM $(C ...
- ASP.NET ZERO 学习 JTable的使用
View信息: @using Abp.Web.Mvc.Extensions @using MedicalSystem.Authorization @using MedicalSystem.Web.Na ...
- 树状数组--模版1和2 P3368、P3374
题目描述 如题,已知一个数列,你需要进行下面两种操作: 将某一个数加上 x 求出某区间每一个数的和 输入格式 第一行包含两个正整数 n,m,分别表示该数列数字的个数和操作的总个数. 第二行包含 n 个 ...
- 17。3.12---re模块--正则表达式操作指南
1----python re模块(Regular Expressioin正则表达式)提供了一个与perl等编程语言类似的正则匹配操作,他是一个处理python字符串的强有力的工具,有自己的语法和独立的 ...