22 lines
675 B
Python
22 lines
675 B
Python
import tensorflow as tf
|
|
import numpy as np
|
|
|
|
def build_model():
|
|
model = tf.keras.Sequential([
|
|
tf.keras.layers.Dense(16, activation='relu', input_shape=(5,)),
|
|
tf.keras.layers.Dense(8, activation='relu'),
|
|
tf.keras.layers.Dense(1, activation='linear')
|
|
])
|
|
model.compile(optimizer='adam', loss='mse', metrics=['mae'])
|
|
return model
|
|
|
|
def train_model(X_train, y_train):
|
|
model = build_model()
|
|
model.fit(X_train, y_train, epochs=100, batch_size=8, verbose=0)
|
|
return model
|
|
|
|
# 사용 예시:
|
|
# input: [physical, stamina, tech, accuracy, reading]
|
|
# X_train = np.array([[12.5, 26, 0.41, 0.1, 0.0], ...])
|
|
# y_train = np.array([11.0, ...])
|