phase 1
This commit is contained in:
19
model/train.py
Normal file
19
model/train.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import json
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
|
||||
with open('model/dataset.json', 'r') as f:
|
||||
data = json.load(f)
|
||||
|
||||
X = np.array([d['x'] for d in data])
|
||||
y = np.array([d['y'] for d in data])
|
||||
|
||||
model = tf.keras.Sequential([
|
||||
tf.keras.layers.Dense(32, activation='relu', input_shape=(4,)),
|
||||
tf.keras.layers.Dense(16, activation='relu'),
|
||||
tf.keras.layers.Dense(1)
|
||||
])
|
||||
model.compile(optimizer='adam', loss='mse')
|
||||
model.fit(X, y, epochs=200, verbose=0)
|
||||
model.save('model/constant_model.keras')
|
||||
print("Model saved to model/constant_model.keras")
|
||||
Reference in New Issue
Block a user