[英]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 .我不理解的是,在后写入器创建2标准定标器对象
sc_X = StandardScaler()
和sc_y = StandardScaler()
分配相同Standard Scaler
,以两个不同的变量sc_X
和sc_y
并使用每一个用于X
和y
分开。 While previous line he creates le_X = LabelEncoder()
assigning LabelEncoder()
to one variable le_X
to be used on both X
and y
.虽然以前的线,他将创建
le_X = LabelEncoder()
分配LabelEncoder()
到一个变量le_X
要对既使用X
和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
.我不明白他为什么要创建两个变量相同的功能,要对每个*单独使用
X
和y
,然后创建一个变量同时用于X
和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. LabelEncoder不需要从数据中提取信息即可工作,该程序只是在系列上运行并以数字形式转换目标值。
The StandardScale compute mean and variance of the column to scale them. StandardScale计算列的均值和方差以缩放它们。
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.看到这一点,x 和 y 列可能有 2 个不同的均值和标准差,需要单独计算,这就是他们创建 2 个对象的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.