cara membuat model di tensorflow

# Simple Model in Tensorflow

import tensorflow as tf
from tensorflow import keras
import numpy as np

#creating model
model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])

#input to model
xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)
ys = np.array([-2.0, 1.0, 4.0, 7.0, 10.0, 13.0], dtype=float)

model.compile(optimizer='sgd', loss='mean_squared_error')

#Now train the model
model.fit(xs, ys, epochs=500)

#Using Model
print(model.predict([10.0]))
Rafiullah Khan