Skip to content

Instantly share code, notes, and snippets.

@hackintoshrao
Last active May 6, 2018 02:24
Show Gist options
  • Save hackintoshrao/9d66374b46bc26c25792cdd67cbe2a21 to your computer and use it in GitHub Desktop.
Save hackintoshrao/9d66374b46bc26c25792cdd67cbe2a21 to your computer and use it in GitHub Desktop.
tensorflow model for linear regression
def get_model_tensors():
"""
function obtain model tensor
"""
# X is the placeholder for size of the house from the dataset.
# Y is the placeholder for size of the house from the dataset.
X = tf.placeholder("float")
Y = tf.placeholder("float")
# The parameters theta0 and theta1
theta1 = tf.Variable(np.random.randn(), name="weight")
theta0 = tf.Variable(np.random.randn(), name="bias")
# Hypothesis = theta0 + theta1 * X
x_theta1 = tf.multiply(X, theta1)
model = tf.add(x_theta1 , theta0)
return X, Y, theta1, theta0, model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment