小编Els*_*Lin的帖子

使用Tensorflow的多元线性回归模型

我想使用Tensorflow构建一个多元线性回归模型.

数据集:波特兰房价

一个数据示例:2104,3,399900(前两个是功能,最后一个是房价;我们有47个示例)

代码如下:

import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt

# model parameters as external flags
flags = tf.app.flags
FLAGS = flags.FLAGS
flags.DEFINE_float('learning_rate', 1.0, 'Initial learning rate.')
flags.DEFINE_integer('max_steps', 100, 'Number of steps to run trainer.')
flags.DEFINE_integer('display_step', 100, 'Display logs per step.')


def run_training(train_X, train_Y):
    X = tf.placeholder(tf.float32, [m, n])
    Y = tf.placeholder(tf.float32, [m, 1])

    # weights
    W = tf.Variable(tf.zeros([n, 1], dtype=np.float32), name="weight")
    b = tf.Variable(tf.zeros([1], dtype=np.float32), name="bias")

    # linear model
    activation = tf.add(tf.matmul(X, …
Run Code Online (Sandbox Code Playgroud)

python numpy machine-learning linear-regression tensorflow

7
推荐指数
1
解决办法
8424
查看次数

在TensorFlow中tf.argmax()vs tf.arg_max()

这似乎tf.argmax()tf.arg_max()正在做同样的事情在矩阵输出的最大元素的印度.

https://www.tensorflow.org/api_docs/python/tf/argmax https://www.tensorflow.org/api_docs/python/tf/arg_max

为什么TensorFlow有两个API?

python tensorflow

4
推荐指数
1
解决办法
5630
查看次数