Laurence Moroney's first tutorial
import tensorflow as tf
import numpy as np
from tensorflow import keras
xs = np.array([-1, 0, 1,2,3,4,5,6], dtype = float)
ys = np.array([-2, 1 , 4 , 7, 10, 13,16, 19], dtype = float)
model = keras.models.Sequential([
keras.layers.Dense(units = 1 , input_shape=[1])
])
model.compile(optimizer = "sgd" , loss = "mean_squared_error")
model.fit(xs, ys,epochs = 50)
print(model.predict([10]))
No comments:
Post a Comment