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 ...
随机推荐
- 图数据库ubentu环境neo4j安装
1.下载进入官网下载https://neo4j.com/download-center/#releases 2.设置依赖仓库 wget -O - https://debian.neo4j.org/ne ...
- ElasticSearch的9200和9300端口的区别
9200用于外部通讯,基于http协议,程序与es的通信使用9200端口. 9300jar之间就是通过tcp协议通信,遵循tcp协议,es集群中的节点之间也通过9300端口进行通信.
- 计算机网络(7): 传输层TCP和UDP以及TCP的工作方式
UDP:无连接:不保证可靠:面向报文的: TCP:面向连接:提供可靠交付:面向字节流(把应用层的数据分包,每个包装一些字节:不关心应用层给的包多大,而是根据网络状况,窗口大小决定) TCP报文: 序号 ...
- zabbix自定义邮件报警
1.启动动作 2.设定发件人邮箱 进入QQ邮箱: 通过短信验证开启如下服务,并生成授权码: 3.配置收件人
- PAT Advanced 1067 Sort with Swap(0,*) (25) [贪⼼算法]
题目 Given any permutation of the numbers {0, 1, 2,-, N-1}, it is easy to sort them in increasing orde ...
- E - Two Arithmetic Progressions(CodeForces - 710D)(拓展中国剩余定理)
You are given two arithmetic progressions: a1k + b1 and a2l + b2. Find the number of integers x such ...
- ios 真机使用相机闪退问题
需要增加权限 在info文件增加 主要前面的key 后面的cameraDesciption只是一段描述 随便写就可以
- 实现TabControl 选项卡首个标签缩进的方法
借用一张网图说明需求 在网上找了一圈,没有找到直接通过API或者重绘TabControl 的解决方法,最后灵机一动想到了一个折(tou)中(lan)的解决办法 Tab1.TabPages.Clear( ...
- 编译原理_P1003
1. 语法分析 1.1 上下文无关文法的定义 ---- 正规式能定义一下简单的语言,能表示给定结构的固定次数的重复或者没有指定次数的重复 例如:a(ba)5,a(ba)* ---- 正规式不能用于描 ...
- Python_面试题_更新中
Python-面试题 线上操作系统 centos py2和py3的区别 每种数据类型,列举你了解的方法 3 or 9 and 8 字符串的反转 is 和 == 的区别? git流程 v = (1) / ...