Related tutorials:
The “Hello, World!” of TensorFlow
Code:
values_a = np.array([...], dtype=float)
values_b = np.array([...], dtype=float)
l0 = tf.keras.layers.Dense(units=1, input_shape=[1])
model = tf.keras.Sequential([l0])
model = tf.keras.Sequential([
tf.keras.layers.Dense(units=1, input_shape=[1])
])
model.compile(loss='mean_squared_error',
optimizer=tf.keras.optimizers.Adam(0.1))
history = model.fit(values_a, values_b, epochs=500, verbose=False)
print(model.predict([100.0])) # a value of type a to predict b
Imports:
import tensorflow as tf
import numpy as np