Compare commits

..

No commits in common. "cea42abe4181f4ad677b41731ff92c3146ce05ac" and "a5323f617d0f1ad9de11fb33e2f19a2f2afb08e2" have entirely different histories.

5 changed files with 4 additions and 43 deletions

View File

@ -1,20 +0,0 @@
node {
stage('Preparation') {
checkout scm
copyArtifacts projectName: 's470618-metrics', filter: 'metrics.txt', fingerprintArtifacts: true, selector: lastSuccessful(), optional: true, target: './train-eval'
copyArtifacts projectName: 's470618-training', filter: '*.pt', fingerprintArtifacts: true, selector: lastSuccessful(), target: '.'
stage('Evaluate metrics') {
sh "pip install matplotlib"
sh "cd train-eval && ./eval.py"
sh "./plot_metrics.py"
}
}
stage('artifacts') {
echo 'saving artifacts'
archiveArtifacts 'metrics.txt', 'prediction.tsv', 'metrics.png'
}
}
}

View File

@ -1,6 +1,6 @@
node {
checkout scm
def dockerimage = docker.build("train-image", "dockerfile_train")
def dockerimage = docker.build("train-image", "./train-eval")
dockerimage.inside {
stage('Preparation') {
properties([

View File

@ -45,7 +45,7 @@ print ("The accuracy is", acc)
print ("The precission score is ", prec)
print ("The recall score is ", recall)
file = open('metrics.txt', 'a')
file = open('metrics.txt', 'w')
file.write(str(acc) + '\t' + str(prec) + '\t' + str(recall))
file.close()

View File

@ -3,7 +3,7 @@ import numpy as np
import torch
from torch import nn
import pandas as pd
# import subprocess
import subprocess
import sys
from sklearn.model_selection import train_test_split
@ -47,7 +47,7 @@ if __name__ == "__main__":
Y = df[['Survived']]
X.loc[:,('Sex')].replace(['female', 'male'], [0,1], inplace=True) #categorical data transformed to
X_train, X_test, Y_train, Y_test = train_test_split(X,Y, test_size=0.2, shuffle=True) #split the date into train and test sets
X_train, X_test, Y_train, Y_test = train_test_split(X,Y, random_state=45, test_size=0.2, shuffle=True) #split the date into train and test sets
testing_data = pd.concat([X_test, Y_test], axis=1)
testing_data.to_csv('testing_data.csv', sep=',')

View File

@ -1,19 +0,0 @@
#!/usr/bin/python3
import matplotlib
import matplotlib.pyplot as plt
data = []
with open('metrics.txt', 'r') as metrics:
for line in metrics:
data.append(line.strip().split('\t'))
# print(acc)
labels = ['accuracy','precision','recall']
builds = [x for x in range(len(data))]
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
for i in range(3):
ax.plot(builds, [data[x][i] for x in range(len(data))], label=labels[i])
plt.legend()
plt.savefig('metrics.png')