Box-Cox変換
$$
x’ = \begin{cases}
\displaystyle \frac{x^\lambda – 1}{\lambda} & \lambda \neq 0\\
\log x & \lambda = 0\end{cases}
$$
Python
sklearn
#from sklearn from sklearn.preprocessing import PowerTransformer sk_boxcox = PowerTransformer('box-cox') #lambda = sk_boxcox.lambdas_ boxcox_data = sk_boxcox.fit_transform(x) inv_boxcox_data = sk_boxcox.inverse_transform(boxcox_data)
scipy
#from scipy from scipy.stats import boxcox from scipy.special import inv_boxcox boxcox_data = boxcox(x) inv_boxcox_data = inv_boxcox(boxcox_data)