removed evaluation in train.py
This commit is contained in:
parent
837e1aebc0
commit
54bf45f0f6
@ -1,6 +1,6 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
docker { image 'adnovac/ium_s434760:1.1' }
|
docker { image 'adnovac/ium_s434760:1.2' }
|
||||||
}
|
}
|
||||||
parameters{
|
parameters{
|
||||||
buildSelector(
|
buildSelector(
|
||||||
@ -29,7 +29,7 @@ pipeline {
|
|||||||
copyArtifacts(fingerprintArtifacts: true, optional: true, projectName: 's434760-evaluation', selector: buildParameter('WHICH_BUILD_THIS'))
|
copyArtifacts(fingerprintArtifacts: true, optional: true, projectName: 's434760-evaluation', selector: buildParameter('WHICH_BUILD_THIS'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('train')
|
stage('evaluate')
|
||||||
{
|
{
|
||||||
steps
|
steps
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ pipeline {
|
|||||||
stage('send email') {
|
stage('send email') {
|
||||||
steps {
|
steps {
|
||||||
emailext body: currentBuild.result ?: 'SUCCESS',
|
emailext body: currentBuild.result ?: 'SUCCESS',
|
||||||
subject: 's434760 - validation',
|
subject: 's434760 - evaluation',
|
||||||
to: 'annnow19@st.amu.edu.pl'
|
to: 'annnow19@st.amu.edu.pl'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
docker { image 'adnovac/ium_s434760:1.0' }
|
docker { image 'adnovac/ium_s434760:1.2' }
|
||||||
}
|
}
|
||||||
parameters{
|
parameters{
|
||||||
buildSelector(
|
buildSelector(
|
||||||
|
3330
results.csv
3330
results.csv
File diff suppressed because it is too large
Load Diff
46
train.py
46
train.py
@ -12,46 +12,24 @@ X=train_data[input_columns].to_numpy()
|
|||||||
Y=train_data[["Overall"]].to_numpy()
|
Y=train_data[["Overall"]].to_numpy()
|
||||||
model = None
|
model = None
|
||||||
|
|
||||||
if path.exists(model_name):
|
model = keras.Sequential(name="fifa_overall")
|
||||||
model = keras.models.load_model(model_name)
|
model.add(keras.Input(shape=(len(input_columns),), name="player_info"))
|
||||||
else:
|
model.add(layers.Dense(4, activation="relu", name="layer1"))
|
||||||
model = keras.Sequential(name="fifa_overall")
|
model.add(layers.Dense(8, activation="relu", name="layer2"))
|
||||||
model.add(keras.Input(shape=(len(input_columns),), name="player_info"))
|
model.add(layers.Dense(8, activation="relu", name="layer3"))
|
||||||
model.add(layers.Dense(4, activation="relu", name="layer1"))
|
model.add(layers.Dense(5, activation="relu", name="layer4"))
|
||||||
model.add(layers.Dense(8, activation="relu", name="layer2"))
|
model.add(layers.Dense(1, activation="relu", name="output"))
|
||||||
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(),
|
optimizer=keras.optimizers.RMSprop(),
|
||||||
loss=keras.losses.MeanSquaredError(),
|
loss=keras.losses.MeanSquaredError(),
|
||||||
)
|
)
|
||||||
|
|
||||||
history = model.fit(
|
history = model.fit(
|
||||||
X,
|
X,
|
||||||
Y,
|
Y,
|
||||||
batch_size=int(sys.argv[1]),
|
batch_size=int(sys.argv[1]),
|
||||||
epochs=int(sys.argv[2]),
|
epochs=int(sys.argv[2]),
|
||||||
)
|
)
|
||||||
|
|
||||||
model.save(model_name)
|
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)}")
|
|
Loading…
Reference in New Issue
Block a user