removed evaluation in train.py

This commit is contained in:
Anna Nowak 2021-04-30 00:07:34 +02:00
parent 837e1aebc0
commit 54bf45f0f6
4 changed files with 22 additions and 3374 deletions

View File

@ -1,6 +1,6 @@
pipeline {
agent {
docker { image 'adnovac/ium_s434760:1.1' }
docker { image 'adnovac/ium_s434760:1.2' }
}
parameters{
buildSelector(
@ -29,7 +29,7 @@ pipeline {
copyArtifacts(fingerprintArtifacts: true, optional: true, projectName: 's434760-evaluation', selector: buildParameter('WHICH_BUILD_THIS'))
}
}
stage('train')
stage('evaluate')
{
steps
{
@ -46,7 +46,7 @@ pipeline {
stage('send email') {
steps {
emailext body: currentBuild.result ?: 'SUCCESS',
subject: 's434760 - validation',
subject: 's434760 - evaluation',
to: 'annnow19@st.amu.edu.pl'
}
}

View File

@ -1,6 +1,6 @@
pipeline {
agent {
docker { image 'adnovac/ium_s434760:1.0' }
docker { image 'adnovac/ium_s434760:1.2' }
}
parameters{
buildSelector(

File diff suppressed because it is too large Load Diff

View File

@ -12,46 +12,24 @@ X=train_data[input_columns].to_numpy()
Y=train_data[["Overall"]].to_numpy()
model = None
if path.exists(model_name):
model = keras.models.load_model(model_name)
else:
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 = 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(
model.compile(
optimizer=keras.optimizers.RMSprop(),
loss=keras.losses.MeanSquaredError(),
)
)
history = model.fit(
history = model.fit(
X,
Y,
batch_size=int(sys.argv[1]),
epochs=int(sys.argv[2]),
)
)
model.save(model_name)
test_data=pd.read_csv('test.csv')
X_test=test_data[input_columns].to_numpy()
Y_test=test_data[["Overall"]].to_numpy()
results_train = model.evaluate(X, Y, batch_size=128)
results_test = model.evaluate(X_test, Y_test, batch_size=128)
y_pred = model(X_test)
lines = ["Name;Overall;Predicted overall\n"]
for i in range(len(X_test)):
name = test_data["Name"][i]
lines.append(f"{name};{int(Y_test[i])};{int(y_pred[i])}\n")
with open('results.csv', 'w+', encoding="UTF-8") as f:
f.writelines(lines)
with open('evaluation_result.txt', 'w+', encoding="UTF-8") as f:
f.write(f"Train: {str(results_train)}\nTest: {str(results_test)}")
model.save(model_name)