From 3f8b8635548e9246656e3e95810baace8b8d61dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pokrywka?= Date: Fri, 6 May 2022 22:29:05 +0200 Subject: [PATCH] test parameters --- .gitignore | 3 ++- Jenkinsfile | 1 + evaluation.Jenkinsfile | 18 +++++++++--------- evaluation.py | 14 ++++++++++++++ 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index c89d897..16a6450 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ venv .idea model_resutls.txt model -metrics.txt \ No newline at end of file +metrics.txt +metrics.png \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 819ddf3..0735627 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,6 +22,7 @@ pipeline { copyArtifacts filter: '*', projectName: 's444463-create-dataset' sh 'python3 ./deepl.py $EPOCH' archiveArtifacts artifacts: "model" + build job: "s444380-evaluation/master" } } } diff --git a/evaluation.Jenkinsfile b/evaluation.Jenkinsfile index aad509b..72a7623 100644 --- a/evaluation.Jenkinsfile +++ b/evaluation.Jenkinsfile @@ -3,12 +3,12 @@ pipeline { dockerfile true } parameters { - string ( - defaultValue: '10', - description: 'Epochs number', - name: 'EPOCH', - trim: false - ) + gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH' + buildSelector( + defaultSelector: lastSuccessful(), + description: 'From which build copy content', + name: 'BUILD_SELECTOR' + ) } stages { stage('checkout: Check out from version control') { @@ -18,11 +18,11 @@ pipeline { } stage('bash script') { steps { - withEnv(["EPOCH=${params.EPOCH}"]) { - copyArtifacts filter: '*', projectName: 's444463-training/master' + withEnv(["BRANCH=${params.BRANCH}"]) { + copyArtifacts filter: '*', projectName: 's444463-training/$BRANCH' copyArtifacts filter: '*', projectName: 's444463-create-dataset' sh 'python3 ./evaluation.py' - archiveArtifacts artifacts: "metrics.txt" + archiveArtifacts artifacts: "metrics.txt" "metrics.png" } } } diff --git a/evaluation.py b/evaluation.py index b1c3053..6a361b9 100644 --- a/evaluation.py +++ b/evaluation.py @@ -3,6 +3,8 @@ import pandas as pd import numpy as np from sklearn.feature_extraction.text import TfidfVectorizer import scipy +import matplotlib.pyplot as plt +import re if __name__ == "__main__": data = pd.read_csv('fake_job_postings.csv', engine='python') @@ -74,6 +76,18 @@ if __name__ == "__main__": f.write(f"Precision = {precision}\n") f.write(f"Recall = {recall}\n") + + f_read = open("metrics.txt", "r") + content = re.findall('F-SCORE = [0-9.]+', f_read.read()) + fscores = [] + for c in content: + r = re.findall("\d+\.\d+", c) + fscores.append(r[0]) + + plt.plot(fscores) + plt.ylabel('F score') + plt.xticks(np.arange(0, len(fscores)+1, 5)) + plt.savefig('metrics.png') # f.write(f"TP descriptions:") # for i in TP: # f.write(i+'\n')