简体   繁体   English

分离因变量和自变量

[英]separating dependent and independent variables

I have built a linear regression model but don't know what is the need to separate dependent and independent variables我已经建立了一个线性回归 model 但不知道需要分离因变量和自变量

can someone explain the code??有人可以解释代码吗?

x = data.iloc[:, 0:1].values
y = data.iloc[:, 1]

A machine learning model simply works this way: you give it a bunch of inputs and outputs.机器学习 model 就是这样工作的:你给它一堆输入和输出。 Then, when a model is trained, when you give it an input, you expect an output.然后,当训练 model 时,当你给它一个输入时,你期望得到一个 output。

So in the code you gave, x is input, and y is output, to train the model.因此,在您给出的代码中, x是输入, y是 output,以训练 model。 AFAIK, most machine learning frameworks expect inputs and outputs seperately (eg: Keras' fit method ). AFAIK,大多数机器学习框架都期望输入和输出是分开的(例如: Keras 的拟合方法)。 Thus you seperate them before feed into the model.因此,您在输入 model 之前将它们分开。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 目标因变量是连续的,但自变量是分类的 - Target Dependent Variables is continuous but Independent Variables are Categorical R2 得分,以及不相关的自变量和因变量 - R2 score, and uncorrelated independent and dependent variables 当因变量和自变量都在同一个列表中时,如何使用 matplotlib plot - How to plot with matplotlib when both dependent and independent variables are in the same list 非正态分布中因变量和自变量之间的相关性 - Correlation between dependent and independent variables in non-normal distribution 所有自变量都是分类的,因(目标)变量是连续的 - All independent variables are categorical and dependent(target) variable is continuous 在 Pandas 列表中为因变量和自变量选择列时出现关键错误 - key error while selecting columns for dependent and independent variables in pandas list 如何获得非线性多元回归的方程,其中一个变量依赖于python中的其他两个独立变量 - how to get equation for nonlinear mutivariate regression in which one variable is dependent on other two independent variables in python 如何计算多个因变量(y1 和 y2)上的自变量(x)的相关性? - How to calculate corrleation of a independent variable(x) on multiple dependent variables (y1 and y2)? 将因变量可视化为其他两个自变量的 function 的最佳方法,每个变量都是数据农场的一列? - Best way to visualize a dependent variable as a function of two other independent variables, each of them is a column of a datafarme? 在 Flask 中构建 ML model 时,如何预处理我的几个自变量和因变量? - How do I pre-process few of my independent and the dependent variables while building an ML model in Flask?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM