evaluation
This commit is contained in:
parent
f39bf64915
commit
a6f8a4fe78
77
Jenkinsfile
vendored
77
Jenkinsfile
vendored
@ -1,37 +1,62 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
parameters {
|
||||
string(name: 'CUTOFF', defaultValue: '100', description: 'Ilość wierszy do odcięcia')
|
||||
string(name: 'KAGGLE_USERNAME', defaultValue: '', description: 'Kaggle username')
|
||||
password(name: 'KAGGLE_KEY', defaultValue: '', description: 'Kaggle API key')
|
||||
agent {
|
||||
dockerfile true
|
||||
}
|
||||
|
||||
triggers {
|
||||
upstream(upstreamProjects: 's464937-training/training', threshold: hudson.model.Result.SUCCESS)
|
||||
}
|
||||
|
||||
parameters {
|
||||
buildSelector(defaultSelector: lastSuccessful(), description: 'Which build to use for copying artifacts', name: 'BUILD_SELECTOR')
|
||||
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'training', name: 'BRANCH', type: 'PT_BRANCH'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Clone repo') {
|
||||
stage('Clone Repository') {
|
||||
steps {
|
||||
git branch: "main", url: "https://git.wmi.amu.edu.pl/s464937/ium_464937"
|
||||
git branch: 'evaluation', url: "https://git.wmi.amu.edu.pl/s464937/ium_464937"
|
||||
}
|
||||
}
|
||||
stage('Copy Dataset Artifacts') {
|
||||
steps {
|
||||
copyArtifacts filter: 'data/dev.csv,data/test.csv,data/train.csv', projectName: 'z-s464937-create-dataset', selector: buildParameter('BUILD_SELECTOR')
|
||||
}
|
||||
}
|
||||
stage('Copy Training Artifacts') {
|
||||
steps {
|
||||
copyArtifacts filter: 'powerlifting_model.h5', projectName: 's464937-training/' + params.BRANCH, selector: buildParameter('BUILD_SELECTOR')
|
||||
}
|
||||
}
|
||||
stage('Copy Evaluation Artifacts') {
|
||||
steps {
|
||||
copyArtifacts filter: 'metrics.txt', projectName: '_s464937-evaluation/evaluation', selector: buildParameter('BUILD_SELECTOR'), optional: true
|
||||
}
|
||||
}
|
||||
stage("Run predictions") {
|
||||
steps {
|
||||
sh "chmod +x ./predict.py"
|
||||
sh "python3 ./predict.py"
|
||||
archiveArtifacts artifacts: 'powerlifting_test_predictions.csv', onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
stage('Run metrics') {
|
||||
steps {
|
||||
sh 'chmod +x ./metrics.py'
|
||||
sh "python3 ./metrics.py ${currentBuild.number}"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Download and preprocess') {
|
||||
environment {
|
||||
KAGGLE_USERNAME = "szymonbartanowicz"
|
||||
KAGGLE_KEY = "4692239eb65f20ec79f9a59ef30e67eb"
|
||||
}
|
||||
steps {
|
||||
withEnv([
|
||||
"KAGGLE_USERNAME=${env.KAGGLE_USERNAME}",
|
||||
"KAGGLE_KEY=${env.KAGGLE_KEY}"
|
||||
]) {
|
||||
sh "bash ./script1.sh ${params.CUTOFF}"
|
||||
}
|
||||
}
|
||||
stage('Run plot') {
|
||||
steps {
|
||||
sh 'chmod +x ./plot.py'
|
||||
sh 'python3 ./plot.py'
|
||||
}
|
||||
}
|
||||
stage('Archive') {
|
||||
steps {
|
||||
archiveArtifacts artifacts: 'data/*', onlyIfSuccessful: true
|
||||
}
|
||||
stage('Archive Artifacts') {
|
||||
steps {
|
||||
archiveArtifacts artifacts: '*', onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
24
metrics.py
Normal file
24
metrics.py
Normal file
@ -0,0 +1,24 @@
|
||||
# import pandas as pd
|
||||
# from sklearn.metrics import accuracy_score, precision_recall_fscore_support, mean_squared_error
|
||||
# from math import sqrt
|
||||
# import sys
|
||||
#
|
||||
# data = pd.read_csv('powerlifting_test_predictions.csv')
|
||||
# y_pred = data['Predictions']
|
||||
# y_test = data['Actual']
|
||||
# y_test_binary = (y_test >= 3).astype(int)
|
||||
#
|
||||
# build_number = sys.argv[1]
|
||||
#
|
||||
# accuracy = accuracy_score(y_test_binary, y_pred.round())
|
||||
# precision, recall, f1, _ = precision_recall_fscore_support(y_test_binary, y_pred.round(), average='micro')
|
||||
# rmse = sqrt(mean_squared_error(y_test, y_pred))
|
||||
#
|
||||
# print(f'Accuracy: {accuracy}')
|
||||
# print(f'Micro-avg Precision: {precision}')
|
||||
# print(f'Micro-avg Recall: {recall}')
|
||||
# print(f'F1 Score: {f1}')
|
||||
# print(f'RMSE: {rmse}')
|
||||
|
||||
with open(r"metrics.txt", "a") as f:
|
||||
f.write(f"{123},{1}\n")
|
22
plot.py
Normal file
22
plot.py
Normal file
@ -0,0 +1,22 @@
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def main():
|
||||
accuracy = []
|
||||
build_numbers = []
|
||||
|
||||
with open("maetrics.txt") as f:
|
||||
for line in f:
|
||||
accuracy.append(float(line.split(",")[0]))
|
||||
build_numbers.append(int(line.split(",")[1]))
|
||||
|
||||
plt.plot(build_numbers, accuracy)
|
||||
plt.xlabel("Build Number")
|
||||
plt.ylabel("Accuracy")
|
||||
plt.title("Accuracy of the model over time")
|
||||
plt.xticks(range(min(build_numbers), max(build_numbers) + 1))
|
||||
plt.show()
|
||||
|
||||
plt.savefig("plot.png")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue
Block a user