new Jenkins try
This commit is contained in:
parent
44e58f3583
commit
7075223969
|
@ -0,0 +1,35 @@
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
dockerfile true
|
||||||
|
}
|
||||||
|
parameters {
|
||||||
|
epochs(
|
||||||
|
defaultValue: '200',
|
||||||
|
description: 'number of epochs',
|
||||||
|
name: 'EPOCH'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Stage 1') {
|
||||||
|
steps {
|
||||||
|
echo 'Hello world!'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Copy from different Pipeline') {
|
||||||
|
steps {
|
||||||
|
copyArtifacts fingerprintArtifacts: true, projectName: 's444517-create-dataset', selector: lastSuccessful()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Get data save artifacts') {
|
||||||
|
steps {
|
||||||
|
sh 'python3 ./nn_train.py $EPOCH'
|
||||||
|
archiveArtifacts artifacts: 'my_model/saved_model.pb'
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import sys
|
||||||
|
|
||||||
from tensorflow.keras.models import Sequential
|
from tensorflow.keras.models import Sequential
|
||||||
from tensorflow.keras.layers import Dense
|
from tensorflow.keras.layers import Dense
|
||||||
|
@ -52,13 +53,13 @@ model = Sequential()
|
||||||
model.add(Dense(number_of_classes, activation='relu'))
|
model.add(Dense(number_of_classes, activation='relu'))
|
||||||
model.add(Dense(number_of_classes, activation='softmax',input_dim=number_of_features))
|
model.add(Dense(number_of_classes, activation='softmax',input_dim=number_of_features))
|
||||||
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy', 'categorical_accuracy'])
|
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy', 'categorical_accuracy'])
|
||||||
model.fit(x_train_set, dummy_y, epochs=200, validation_data=(x_validate_set, dummy_yv))
|
model.fit(x_train_set, dummy_y, epochs=int(sys.argv[1]), validation_data=(x_validate_set, dummy_yv))
|
||||||
#model.save("my_model/")
|
model.save("my_model/")
|
||||||
|
|
||||||
#model predictions
|
#model predictions
|
||||||
#model = keras.models.load_model('my_model')
|
#model = keras.models.load_model('my_model')
|
||||||
yhat = model.predict(x_test_set)
|
yhat = model.predict(x_test_set)
|
||||||
f = open("results.txt", "w")
|
f = open("results.txt", "w")
|
||||||
for numerator, single_pred in enumerate(yhat):
|
for numerator, single_pred in enumerate(yhat):
|
||||||
f.write(f"PREDICTED: {sorted(y_class_names)[np.argmax(single_pred)]}, ACTUAL: {y_test_set[numerator]} {sorted(y_class_names)[np.argmax(single_pred)] == y_test_set[numerator]}\n")
|
f.write(f"{sorted(y_class_names)[np.argmax(single_pred)]},{y_test_set[numerator]}\n")
|
||||||
f.close()
|
f.close()
|
||||||
|
|
Loading…
Reference in New Issue