Yeo-Johnson变换

2020-10-19  本文已影响0人  山有木兮木有刺

1 为什么要进行Yeo-Johnson变换

To better meet the assumptions of normality and homogenous variances

Yeo-Johnson transformation provides a powerful way of reducing skewness and can be applied to variables that include negative values【1】

参考文献:【1】Global effects of soil and climate on leaf photosynthetic traits and rates 

备注:

help(preprocessing.scale)

scale(X, axis=0, with_mean=True, with_std=True, copy=True)

axis=0:默认是按照每一个特征(即按照列)进行标准化;

axis=1:则为行,按照样本进本进行标准化

代码:


import numpyas np

from sklearn.preprocessingimport PowerTransformer

pt =PowerTransformer(method='yeo-johnson', standardize=True, copy=True)

data = [[1, 2], [3, 2], [4, 5]]

print(pt.fit(data))

PowerTransformer()

print(pt.lambdas_)

print(pt.transform(data))

上一篇下一篇

猜你喜欢

热点阅读