Last active
May 6, 2018 02:24
-
-
Save hackintoshrao/9d66374b46bc26c25792cdd67cbe2a21 to your computer and use it in GitHub Desktop.
tensorflow model for linear regression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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