简体   繁体   English

为什么从同一个包创建不同的对象

[英]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_Xsc_y并使用每一个用于Xy分开 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要对使用Xy 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 .我不明白他为什么要创建两个变量相同的功能,要对每个*单独使用Xy ,然后创建一个变量同时用于Xy 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.

相关问题 为什么pip为相同版本的同一软件包安装不同的二进制文件? - Why is pip installing different binaries for the same version of the same package? 在包中导入Python模块会从同一个包中返回不同的模块 - Importing a Python module in a package returns a different module from the same package 从另一个模块(在同一软件包中)导入一个软件包的一个模块 - Import one module of a package from a different one (in the same package) Python-从另一个包中的一个包创建类的对象 - Python - create object of class from one package in different package 从生成器创建迭代器会返回相同的对象 - Creating iterators from a generator returns the same object 从 Python 中的不同文件创建 Object - Creating An Object From a Different File in Python 来自同一PyQuery对象的不同输出 - Different Output From Same PyQuery Object 如何从同一程序中的其他目录导入包? - How to import a package from a different directory in the same program? 从同一文件但从两个不同位置导入相同的 Python object 会导致两种不同的 object 类型 - Importing the same Python object from the same file but from two different locations results in two different object types 从相同的类创建线程,但使用Python中连接的不同方法创建线程 - Creating threads from the same class but with different methods connected in Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM