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
model_resutls.txt
model
metrics.txt
metrics.txt
metrics.png

1
Jenkinsfile vendored
View File

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

View File

@ -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"
}
}
}

View File

@ -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')