test parameters

This commit is contained in:
Mikołaj Pokrywka 2022-05-06 22:29:05 +02:00
parent 5f926cc75c
commit 3f8b863554
4 changed files with 26 additions and 10 deletions

3
.gitignore vendored
View File

@ -12,4 +12,5 @@ venv
.idea .idea
model_resutls.txt model_resutls.txt
model model
metrics.txt metrics.txt
metrics.png

1
Jenkinsfile vendored
View File

@ -22,6 +22,7 @@ pipeline {
copyArtifacts filter: '*', projectName: 's444463-create-dataset' copyArtifacts filter: '*', projectName: 's444463-create-dataset'
sh 'python3 ./deepl.py $EPOCH' sh 'python3 ./deepl.py $EPOCH'
archiveArtifacts artifacts: "model" archiveArtifacts artifacts: "model"
build job: "s444380-evaluation/master"
} }
} }
} }

View File

@ -3,12 +3,12 @@ pipeline {
dockerfile true dockerfile true
} }
parameters { parameters {
string ( gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH'
defaultValue: '10', buildSelector(
description: 'Epochs number', defaultSelector: lastSuccessful(),
name: 'EPOCH', description: 'From which build copy content',
trim: false name: 'BUILD_SELECTOR'
) )
} }
stages { stages {
stage('checkout: Check out from version control') { stage('checkout: Check out from version control') {
@ -18,11 +18,11 @@ pipeline {
} }
stage('bash script') { stage('bash script') {
steps { steps {
withEnv(["EPOCH=${params.EPOCH}"]) { withEnv(["BRANCH=${params.BRANCH}"]) {
copyArtifacts filter: '*', projectName: 's444463-training/master' copyArtifacts filter: '*', projectName: 's444463-training/$BRANCH'
copyArtifacts filter: '*', projectName: 's444463-create-dataset' copyArtifacts filter: '*', projectName: 's444463-create-dataset'
sh 'python3 ./evaluation.py' sh 'python3 ./evaluation.py'
archiveArtifacts artifacts: "metrics.txt" archiveArtifacts artifacts: "metrics.txt" "metrics.png"
} }
} }
} }

View File

@ -3,6 +3,8 @@ import pandas as pd
import numpy as np import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import TfidfVectorizer
import scipy import scipy
import matplotlib.pyplot as plt
import re
if __name__ == "__main__": if __name__ == "__main__":
data = pd.read_csv('fake_job_postings.csv', engine='python') 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"Precision = {precision}\n")
f.write(f"Recall = {recall}\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:") # f.write(f"TP descriptions:")
# for i in TP: # for i in TP:
# f.write(i+'\n') # f.write(i+'\n')