from sklearn.preprocessing import PowerTransformer # power transform the raw data power = PowerTransformer(method='yeo-johnson', standardize=True) data_trans = power.fit_transform(data) ========================ADDITIONAL INFORMATION================================== ## Few Important things to keep in mind There are two popular approaches(method) for such automatic power transforms; * method='box-cox' It is a power transform that assumes the values of the input variable to which it is applied are strictly positive. That means 0 and negative values are not supported. * method='yeo-johnson' Unlike the Box-Cox transform, it does not require the values for each input variable to be strictly positive. It supports zero values and negative values. This means we can apply it to our dataset without scaling it first.
Read more of this post
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.