forked from s464914/ium_464914
plot
This commit is contained in:
parent
65bf01c425
commit
520206ef22
12
Jenkinsfile
vendored
12
Jenkinsfile
vendored
@ -42,5 +42,17 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage('Plot Accuracy') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def customImage = docker.build("custom-image")
|
||||||
|
customImage.inside {
|
||||||
|
sh 'python3 ./plot.py'
|
||||||
|
archiveArtifacts artifacts: 'accuracy.png', onlyIfSuccessful: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,8 +18,7 @@ rmse = np.sqrt(mean_squared_error(true_labels, predicted_labels))
|
|||||||
|
|
||||||
with open(r'metrics.txt', 'a') as fp:
|
with open(r'metrics.txt', 'a') as fp:
|
||||||
fp.write(f"Accuracy: {accuracy}\n")
|
fp.write(f"Accuracy: {accuracy}\n")
|
||||||
fp.write(f"Micro-average Precision: {precision_micro}\n")
|
fp.write(f"Precision: {precision_micro}\n")
|
||||||
fp.write(f"Micro-average Recall: {recall_micro}\n")
|
fp.write(f"Recall: {recall_micro}\n")
|
||||||
fp.write(f"Micro-average F1-score: {f1_micro}\n")
|
fp.write(f"F1-score: {f1_micro}\n")
|
||||||
fp.write(f"RMSE: {rmse}\n")
|
fp.write(f"RMSE: {rmse}\n")
|
||||||
fp.write("--------------------\n")
|
|
21
plot.py
Normal file
21
plot.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
accuracy = []
|
||||||
|
|
||||||
|
f = open("metrics.txt", "r")
|
||||||
|
for line in f:
|
||||||
|
parts = line.strip().split(' ')
|
||||||
|
if(parts[0] == 'Accuracy:'):
|
||||||
|
accuracy.append(float(parts[1]))
|
||||||
|
|
||||||
|
y_values = np.arange(1, len(accuracy) + 1)
|
||||||
|
|
||||||
|
plt.plot(y_values, accuracy, marker='o', linestyle='-', color='b')
|
||||||
|
plt.xlabel('Build Number')
|
||||||
|
plt.ylabel('Accuracy')
|
||||||
|
plt.title('Accuracy Plot')
|
||||||
|
plt.grid(True)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
plt.savefig('accuracy.png')
|
Loading…
Reference in New Issue
Block a user