当前位置:网站首页>Machine learning -- detailed introduction of standardscaler (), transform (), fit () in sklearn package
Machine learning -- detailed introduction of standardscaler (), transform (), fit () in sklearn package
2022-07-25 09:28:00 【Bubble Yi】
- sklearn(scikit-learn) yes Scipy An extension of , Based on the NumPy and matplotlib Library based . since 2007 Since its release ,sklearn Has become a Python Important machine learning library .
- sklearn Support includes classification 、 Return to 、 The four big machine learning algorithms of descending and clustering . It also includes feature extraction 、 Data processing and model evaluation .
One 、 Sklearn In bag StandardScaler()
1. from sklearn.preprocessing import StandardScaler # Import standardized functions in the data processing module
2. SS = StandardScaler() # Generate entity class module
3. scaler=SS.fit(X_train) # In essence, it is to find the mean and variance of each column
4. X_train=scaler.transform(X_train) # Standardize the data columns
5.# Use the mean and variance of each column in the training set to standardize each column in the test set .
test1=scaler.transform(X_test1)
test2=scaler.transform(X_test2)
Two 、 Method 2 ( Data standardization ):
mean=train_data.mean(axis=0)
train_data-=mean
std=train_data.std(axis=0)
train_data/=std
test_data-=mean
test_data/=stdBe careful , The mean and standard deviation used for the standardization of test data are calculated on the training data . In the workflow , You can't calculate any results on the test data , Even simple things like data standardization are not allowed .
边栏推荐
- [GYCTF2020]Node Game
- office文件对应的Content-Type类型
- 在Ubuntu中安装MySQL并创建新用户
- [GKCTF 2021]easynode
- Week小结
- Nacos搭建配置中心出现client error: invalid param. endpoint is blank
- SSM框架整合,简单案例
- Understand why we should rewrite the equals method and hashcode method at the same time + example analysis
- 什么是单机、集群与分布式?
- 『每日一问』简单聊聊JMM/说说对JMM的了解
猜你喜欢

*7-1 CCF 2015-09-1 数列分段

Week小结

@1-1 CCF 2021-04-1 灰度直方图

Unable to start debugging on the web server, the web server failed to find the requested resource

数据预处理

How can technologists start their personal brand? Exclusive teaching of top five KOLs

『每日一问』简单聊聊JMM/说说对JMM的了解

Activemq-- delayed delivery and scheduled delivery

¥1-1 SWUST oj 941: 有序顺序表的合并操作的实现

PHP网站设计思路
随机推荐
¥1-1 SWUST oj 941: 有序顺序表的合并操作的实现
Thymeleaf 笔记
Go基础4
Redis数据库基础
基本的网络知识
MySQL appends a string to the string of a field in the table [easy to understand]
『怎么用』代理模式
SSM框架整合,简单案例
分享一个避免递归的部门设计方法
保姆级Scanner类使用详解
Difference between redis and mongodb (useful for interview)
OverTheWire-Bandit
PHP网站设计思路
Go foundation 2
机器学习 —— Sklearn包中StandardScaler()、transform()、fit()的详细介绍
*7-1 CCF 2015-09-1 数列分段
正奇边形可划分成多少区域
Notes on in-depth analysis of C language 2
jsPDF生成PDF文件,文件不全问题,后台进行文件下载,前台不下载
Deep understanding of static keyword