Skip to content

Instantly share code, notes, and snippets.

@cedricconol
Created May 23, 2020 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cedricconol/f70f015172fad78903dddb790cdea272 to your computer and use it in GitHub Desktop.
Save cedricconol/f70f015172fad78903dddb790cdea272 to your computer and use it in GitHub Desktop.
Linear regression TF2 train
def train(self, X, y, learning_rate=0.01, epochs=5):
if len(X.shape)==1:
X=tf.reshape(X,[X.shape[0],1])
self.m.assign([self.var]*X.shape[-1])
for i in range(epochs):
print("Epoch: ", i)
self.update(X, y, learning_rate)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment