35 lines
970 B
Python
35 lines
970 B
Python
import pandas as pd
|
|
from os import path
|
|
from tensorflow import keras
|
|
from tensorflow.keras import layers
|
|
import sys
|
|
|
|
model_name = "model.h5"
|
|
train_data=pd.read_csv('train.csv')
|
|
|
|
input_columns=["Age","Nationality","Position","Club"]
|
|
X=train_data[input_columns].to_numpy()
|
|
Y=train_data[["Overall"]].to_numpy()
|
|
model = None
|
|
|
|
model = keras.Sequential(name="fifa_overall")
|
|
model.add(keras.Input(shape=(len(input_columns),), name="player_info"))
|
|
model.add(layers.Dense(4, activation="relu", name="layer1"))
|
|
model.add(layers.Dense(8, activation="relu", name="layer2"))
|
|
model.add(layers.Dense(8, activation="relu", name="layer3"))
|
|
model.add(layers.Dense(5, activation="relu", name="layer4"))
|
|
model.add(layers.Dense(1, activation="relu", name="output"))
|
|
|
|
model.compile(
|
|
optimizer=keras.optimizers.RMSprop(),
|
|
loss=keras.losses.MeanSquaredError(),
|
|
)
|
|
|
|
history = model.fit(
|
|
X,
|
|
Y,
|
|
batch_size=int(sys.argv[1]),
|
|
epochs=int(sys.argv[2]),
|
|
)
|
|
|
|
model.save(model_name) |