简体   繁体   中英

Why creating different object from same package

I just learned something from this site . I do not understand that in the post the writer create 2 standard scaler object sc_X = StandardScaler() and sc_y = StandardScaler() , assigning same Standard Scaler to two different variables sc_X and sc_y and use each for X and y separately . While previous line he creates le_X = LabelEncoder() assigning LabelEncoder() to one variable le_X to be used on both X and y . I do not understand why he creates two variables for same function to be used separately on *each X and y and then create one variable to be used for both X and y . I'm so confused right now. Please someone explain why is it like that

The LabelEncoder don't need to extract information from the data to work, this program just run on the series and transform the target values in numbers.

The StandardScale compute mean and variance of the column to scale them.

Seen this, the x and y column may have 2 different mean and standard deviation, needing to be computed separately and that is why they created 2 objects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM