Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在Tensorflow上用我自己的数据使用线性回归模型_Python_Tensorflow_Linear Regression - Fatal编程技术网

Python 如何在Tensorflow上用我自己的数据使用线性回归模型

Python 如何在Tensorflow上用我自己的数据使用线性回归模型,python,tensorflow,linear-regression,Python,Tensorflow,Linear Regression,我有这样的数据集 [2016-10-24,23.00,76.00,1015.40,0.00,0.00,100.00,26.00,100.00,100.00,0.00,6.88,186.01,12.26,220.24,27.60,262.50,14.04,2.1] , [15.47] [2016-10-24,22.00,73.00,1014.70,0.00,0.00,10.20,34.00,0.00,2.00,0.00,6.49,176.82,11.97,201.16,24.27,249.15,7

我有这样的数据集

[2016-10-24,23.00,76.00,1015.40,0.00,0.00,100.00,26.00,100.00,100.00,0.00,6.88,186.01,12.26,220.24,27.60,262.50,14.04,2.1] , [15.47]
[2016-10-24,22.00,73.00,1014.70,0.00,0.00,10.20,34.00,0.00,2.00,0.00,6.49,176.82,11.97,201.16,24.27,249.15,7.92,0.669999 ] , [16.14]
....
....
这个的大小是[n][19],[n][1]。我想使用Tensorflow线性回归在Python上进行预测。我的意思是我想用这19个变量来预测1个变量。我有大数据集。我想这就足够训练了

然而,我是机器学习和Tensorflow的初学者。你能给我一些文件或线索吗?
提前感谢。

这是一个简单的线性回归模型:

def model(X, w):
    return tf.mul(X, w) # Just X*w so this model line is pretty simple

w = tf.Variable(0.0, name="weights") 
y_model = model(X, w)

cost = tf.square(Y - y_model) # use square error for cost function
train_op = tf.train.GradientDescentOptimizer(0.01).minimize(cost) 
然后您需要在TensorFlow会话下运行train_op


对于数据集,只需更改w和x。更多示例请参见。

如果您是机器学习的初学者,那么Tensorflow可能对您在这里想要做的事情过于苛刻。我建议从sklearn图书馆开始。他们支持线性回归。事实上,我知道我需要改变X变量,因为我有一个以上的输入。但是,我仍然不知道如何将X转换为[16]这样的数组。还有,为什么我需要改变。?。