Add evaluation
Some checks failed
s434704-training/pipeline/head There was a failure building this commit
Some checks failed
s434704-training/pipeline/head There was a failure building this commit
This commit is contained in:
parent
1bbae86054
commit
f1083d4e7a
42
Jenkins_eval
Normal file
42
Jenkins_eval
Normal file
@ -0,0 +1,42 @@
|
||||
pipeline {
|
||||
agent {
|
||||
dockerfile true
|
||||
}
|
||||
parameters {
|
||||
buildSelector(defaultSelector: lastSuccessful(), description: 'Use latest build training', name: 'BUILD_SELECTOR_TRAINING'),
|
||||
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'branchName', type: 'PT_BRANCH',
|
||||
|
||||
}
|
||||
stages {
|
||||
stage("Copy artifacts"){
|
||||
steps {
|
||||
copyArtifacts fingerprintArtifacts: true, projectName: 's434704-training/${params.branchName}', selector: buildParameter('BUILD_SELECTOR')
|
||||
copyArtifacts fingerprintArtifacts: true, projectName: 's434704-evaluation', selector: buildParameter(lastSuccessful(), optional: true)
|
||||
copyArtifacts fingerprintArtifacts: true, projectName: 's434704-create-dataset', selector: buildParameter(lastSuccessful())
|
||||
}
|
||||
}
|
||||
stage("Run evaluation"){
|
||||
steps {
|
||||
sh "python3 evaluation.py"
|
||||
}
|
||||
}
|
||||
stage('Archive single metrics') {
|
||||
steps{
|
||||
archiveArtifacts 'single_metrics.txt'
|
||||
}
|
||||
}
|
||||
stage('Save metrics to bulk file & create chart') {
|
||||
steps{
|
||||
sh "if [ -f "single_metrics.txt" ]; "${env.BUILD_ID} ${cat single_metrics.txt}" >> bulk_metrics.txt fi"
|
||||
archiveArtifacts 'bulk_metrics.txt'
|
||||
sh "python3 create_chart.py"
|
||||
archiveArtifacts 'chart.png'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
mail body: "EVALUATION - ${currentBuild.currentResult}", subject: 's434704', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||
}
|
||||
}
|
||||
}
|
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -28,7 +28,7 @@ stages {
|
||||
post {
|
||||
success {
|
||||
build job: 's434704-training/master', parameters: [
|
||||
string(name: 'options', value: "-shuffle=true")
|
||||
string(name: 'options', value: "verpose=0 epochs=100")
|
||||
], wait: false
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ pipeline {
|
||||
dockerfile true
|
||||
}
|
||||
parameters {
|
||||
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH'
|
||||
string(name: 'options', description: 'Trainig script options')
|
||||
buildSelector(defaultSelector: lastSuccessful(), description: 'Use latest build', name: 'BUILD_SELECTOR')
|
||||
}
|
||||
@ -25,7 +26,12 @@ pipeline {
|
||||
}
|
||||
post {
|
||||
always {
|
||||
mail body: "${currentBuild.currentResult}", subject: 's434704', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||
mail body: "TRAINING - ${currentBuild.currentResult}", subject: 's434704', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
|
||||
}
|
||||
success {
|
||||
build job: 's434704-evaluation/master', parameters: [
|
||||
string(name: 'branchName', value: "${params.BRANCH}")
|
||||
], wait: false
|
||||
}
|
||||
}
|
||||
}
|
20
create_chart.py
Normal file
20
create_chart.py
Normal file
@ -0,0 +1,20 @@
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
import matplotlib
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
x = []
|
||||
y = []
|
||||
|
||||
if os.path.exists('bulk_metrics.txt'):
|
||||
with open('bulk_metrics.txt') as file:
|
||||
for line in file.readlines():
|
||||
single_x, single_y = line.split(" ")
|
||||
x.append(single_x)
|
||||
y.append(single_y)
|
||||
|
||||
plt.plot(x, y)
|
||||
plt.xlabel('Jobs')
|
||||
plt.ylabel('RMSE')
|
||||
plt.savefig('chart.png')
|
28
evaluation.py
Normal file
28
evaluation.py
Normal file
@ -0,0 +1,28 @@
|
||||
import sys
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
import os.path
|
||||
|
||||
from tensorflow import keras
|
||||
from tensorflow.keras import layers
|
||||
from tensorflow.keras.layers.experimental import preprocessing
|
||||
|
||||
# Wczytanie danych
|
||||
test_data = pd.read_csv("./MoviesOnStreamingPlatforms_updated.test")
|
||||
|
||||
columns_to_use = ['Year', 'Runtime', 'Netflix']
|
||||
test_X = tf.convert_to_tensor(test_data[columns_to_use])
|
||||
test_Y = tf.convert_to_tensor(test_data[["IMDb"]])
|
||||
|
||||
model = tf.keras.models.load_model('linear_regression.h5')
|
||||
|
||||
scores = model.evaluate(x=test_X,
|
||||
y=test_Y)
|
||||
|
||||
with open('single_metrics.txt', 'w') as file:
|
||||
for idx, score in enumerate(scores):
|
||||
if idx == 0:
|
||||
file.write("Recall: " + str(score) + "\n")
|
||||
if idx == 1:
|
||||
file.write("RMSE: " + str(score) + "\n")
|
BIN
linear_regression.h5
Normal file
BIN
linear_regression.h5
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,6 +3,7 @@ astunparse==1.6.3
|
||||
cachetools==4.2.1
|
||||
certifi==2020.12.5
|
||||
chardet==4.0.0
|
||||
cycler==0.10.0
|
||||
flatbuffers==1.12
|
||||
gast==0.4.0
|
||||
google-auth==1.29.0
|
||||
@ -15,14 +16,18 @@ joblib==1.0.1
|
||||
kaggle==1.5.12
|
||||
keras-nightly==2.5.0.dev2021032900
|
||||
Keras-Preprocessing==1.1.2
|
||||
kiwisolver==1.3.1
|
||||
Markdown==3.3.4
|
||||
matplotlib==3.4.2
|
||||
numpy==1.19.5
|
||||
oauthlib==3.1.0
|
||||
opt-einsum==3.3.0
|
||||
pandas==1.2.4
|
||||
Pillow==8.2.0
|
||||
protobuf==3.15.8
|
||||
pyasn1==0.4.8
|
||||
pyasn1-modules==0.2.8
|
||||
pyparsing==2.4.7
|
||||
python-dateutil==2.8.1
|
||||
python-slugify==4.0.1
|
||||
pytz==2021.1
|
||||
|
331
results.txt
331
results.txt
@ -1,331 +0,0 @@
|
||||
0.5936598
|
||||
0.5849244
|
||||
0.76666903
|
||||
0.67934513
|
||||
0.64723533
|
||||
0.70146203
|
||||
0.6212848
|
||||
0.69352806
|
||||
0.71430266
|
||||
0.6349592
|
||||
0.6037227
|
||||
0.62602526
|
||||
0.716088
|
||||
0.6527825
|
||||
0.61927134
|
||||
0.6208715
|
||||
0.5705818
|
||||
0.5874928
|
||||
0.6404664
|
||||
0.58791584
|
||||
0.67543894
|
||||
0.62167656
|
||||
0.6206067
|
||||
0.64806134
|
||||
0.5552458
|
||||
0.75341594
|
||||
0.6072247
|
||||
0.6813532
|
||||
0.58791584
|
||||
0.60726017
|
||||
0.6250376
|
||||
0.62341076
|
||||
0.5916721
|
||||
0.73439735
|
||||
0.70303845
|
||||
0.6799106
|
||||
0.6091962
|
||||
0.61927134
|
||||
0.8370657
|
||||
0.61847275
|
||||
0.62586755
|
||||
0.68109375
|
||||
0.5506313
|
||||
0.54138035
|
||||
0.59432256
|
||||
0.5910602
|
||||
0.5725273
|
||||
0.61110884
|
||||
0.6139354
|
||||
0.698549
|
||||
0.6325473
|
||||
0.6033801
|
||||
0.63960016
|
||||
0.6930497
|
||||
0.6141507
|
||||
0.690398
|
||||
0.6700437
|
||||
0.54408246
|
||||
0.54744244
|
||||
0.67295927
|
||||
0.5979732
|
||||
0.67771566
|
||||
0.6260898
|
||||
0.6237586
|
||||
0.6182915
|
||||
0.5431411
|
||||
0.6237045
|
||||
0.56352425
|
||||
0.5980723
|
||||
0.7263526
|
||||
0.61543685
|
||||
0.6306595
|
||||
0.6136954
|
||||
0.6077196
|
||||
0.54555225
|
||||
0.6265953
|
||||
0.6129655
|
||||
0.6964393
|
||||
0.5952996
|
||||
0.76597196
|
||||
0.612132
|
||||
0.7141346
|
||||
0.61887026
|
||||
0.62167656
|
||||
0.78501934
|
||||
0.5870993
|
||||
0.622163
|
||||
0.7269425
|
||||
0.6047483
|
||||
0.738512
|
||||
0.62428063
|
||||
0.5981832
|
||||
0.6053737
|
||||
0.57737106
|
||||
0.6236219
|
||||
0.66317254
|
||||
0.57937706
|
||||
0.7312876
|
||||
0.6494799
|
||||
0.63968897
|
||||
0.5651109
|
||||
0.6759594
|
||||
0.5775144
|
||||
0.5936598
|
||||
0.63960016
|
||||
0.58682525
|
||||
0.71019185
|
||||
0.56100094
|
||||
0.67674595
|
||||
0.6096024
|
||||
0.69002897
|
||||
0.6200595
|
||||
0.57937706
|
||||
0.7399035
|
||||
0.6408503
|
||||
0.6944639
|
||||
0.61505663
|
||||
0.65129274
|
||||
0.62243
|
||||
0.60202354
|
||||
0.58697325
|
||||
0.6366977
|
||||
0.6581801
|
||||
0.5887744
|
||||
0.64327353
|
||||
0.5775144
|
||||
0.600708
|
||||
0.7870045
|
||||
0.66495174
|
||||
0.73288137
|
||||
0.6411598
|
||||
0.5922716
|
||||
0.82116383
|
||||
0.6830768
|
||||
0.5775144
|
||||
0.5493086
|
||||
0.60465336
|
||||
0.71464497
|
||||
0.63086146
|
||||
0.8296491
|
||||
0.6182472
|
||||
0.5995659
|
||||
0.6235519
|
||||
0.55489665
|
||||
0.6356955
|
||||
0.57629323
|
||||
0.6342664
|
||||
0.64431417
|
||||
0.60523593
|
||||
0.65745866
|
||||
0.684063
|
||||
0.7090692
|
||||
0.551341
|
||||
0.6960265
|
||||
0.6134735
|
||||
0.6319828
|
||||
0.69399494
|
||||
0.6586382
|
||||
0.6184454
|
||||
0.579377
|
||||
0.5624325
|
||||
0.6291094
|
||||
0.5526188
|
||||
0.6200053
|
||||
0.67691404
|
||||
0.64806134
|
||||
0.71236795
|
||||
0.5982099
|
||||
0.7223163
|
||||
0.70254266
|
||||
0.5769756
|
||||
0.6886634
|
||||
0.5427406
|
||||
0.6079933
|
||||
0.69164056
|
||||
0.7077326
|
||||
0.719109
|
||||
0.66267097
|
||||
0.579265
|
||||
0.69516224
|
||||
0.5506313
|
||||
0.61759067
|
||||
0.62851924
|
||||
0.5809279
|
||||
0.7018177
|
||||
0.7282298
|
||||
0.6892376
|
||||
0.72701484
|
||||
0.5552458
|
||||
0.62603444
|
||||
0.6191902
|
||||
0.64947087
|
||||
0.5757011
|
||||
0.61934066
|
||||
0.6420203
|
||||
0.68608767
|
||||
0.6914434
|
||||
0.5648086
|
||||
0.5936598
|
||||
0.62404615
|
||||
0.58697325
|
||||
0.68826014
|
||||
0.5743765
|
||||
0.62311804
|
||||
0.5673747
|
||||
0.6645754
|
||||
0.6006698
|
||||
0.6139312
|
||||
0.605672
|
||||
0.61527056
|
||||
0.61543274
|
||||
0.6497899
|
||||
0.6445152
|
||||
0.6175213
|
||||
0.613054
|
||||
0.63025105
|
||||
0.66208804
|
||||
0.56561863
|
||||
0.60712475
|
||||
0.5769756
|
||||
0.6977379
|
||||
0.7078162
|
||||
0.6081246
|
||||
0.6097158
|
||||
0.6237586
|
||||
0.5988606
|
||||
0.6206067
|
||||
0.6527825
|
||||
0.66423184
|
||||
0.6055651
|
||||
0.6602301
|
||||
0.68199044
|
||||
0.5838982
|
||||
0.6191426
|
||||
0.5835939
|
||||
0.5699177
|
||||
0.59172297
|
||||
0.61360157
|
||||
0.5893885
|
||||
0.6019349
|
||||
0.6636439
|
||||
0.6308284
|
||||
0.61177546
|
||||
0.60210186
|
||||
0.6817741
|
||||
0.78398675
|
||||
0.6113895
|
||||
0.6719309
|
||||
0.600708
|
||||
0.7056101
|
||||
0.6404664
|
||||
0.57761484
|
||||
0.5705818
|
||||
0.64431417
|
||||
0.6320444
|
||||
0.7149821
|
||||
0.66350126
|
||||
0.6117868
|
||||
0.6053978
|
||||
0.65883034
|
||||
0.6160903
|
||||
0.62467444
|
||||
0.6141507
|
||||
0.56460583
|
||||
0.6075608
|
||||
0.71549106
|
||||
0.59031665
|
||||
0.5947179
|
||||
0.5578261
|
||||
0.68199044
|
||||
0.6732133
|
||||
0.58061934
|
||||
0.75385326
|
||||
0.63099474
|
||||
0.55258214
|
||||
0.6357683
|
||||
0.6386257
|
||||
0.6683411
|
||||
0.617758
|
||||
0.8129497
|
||||
0.6143774
|
||||
0.61251193
|
||||
0.67745715
|
||||
0.6147938
|
||||
0.7365375
|
||||
0.6236495
|
||||
0.6806918
|
||||
0.6894972
|
||||
0.6269105
|
||||
0.6205633
|
||||
0.66388756
|
||||
0.6088129
|
||||
0.6154119
|
||||
0.62330747
|
||||
0.62925434
|
||||
0.6778992
|
||||
0.5844303
|
||||
0.6399225
|
||||
0.6335639
|
||||
0.66535574
|
||||
0.54796815
|
||||
0.6119701
|
||||
0.61533546
|
||||
0.72435665
|
||||
0.69239396
|
||||
0.70170265
|
||||
0.6722494
|
||||
0.69742507
|
||||
0.6009209
|
||||
0.615307
|
||||
0.6636749
|
||||
0.5761081
|
||||
0.6136954
|
||||
0.57523835
|
||||
0.6359734
|
||||
0.60489464
|
||||
0.6540913
|
||||
0.7366513
|
||||
0.58649015
|
||||
0.6129386
|
||||
0.5581885
|
||||
0.6212848
|
||||
0.5769756
|
||||
0.61741394
|
||||
0.57121605
|
||||
0.6268614
|
||||
0.6249659
|
||||
0.6359734
|
||||
0.660387
|
||||
0.7373885
|
||||
0.7026211
|
19
training.py
19
training.py
@ -11,7 +11,9 @@ from tensorflow.keras.layers.experimental import preprocessing
|
||||
|
||||
arguments = sys.argv[1:]
|
||||
|
||||
activation_func = [command.split('=')[1] for command in arguments if command.split('=')[0] == '--activation_func']
|
||||
verbose = [command.split('=')[1] for command in arguments if command.split('=')[0] == 'verbose']
|
||||
epochs = [command.split('=')[1] for command in arguments if command.split('=')[0] == 'epochs']
|
||||
|
||||
|
||||
pd.set_option("display.max_columns", None)
|
||||
|
||||
@ -32,15 +34,18 @@ else:
|
||||
model = keras.Sequential([
|
||||
keras.Input(shape=(len(columns_to_use),)),
|
||||
normalizer,
|
||||
layers.Dense(30, activation='relu' if len(activation_func) == 0 else activation_func[0]),
|
||||
layers.Dense(10, activation='relu' if len(activation_func) == 0 else activation_func[0]),
|
||||
layers.Dense(25, activation='relu' if len(activation_func) == 0 else activation_func[0]),
|
||||
layers.Dense(30, activation='relu'),
|
||||
layers.Dense(10, activation='relu'),
|
||||
layers.Dense(25, activation='relu'),
|
||||
layers.Dense(1)
|
||||
])
|
||||
|
||||
model.compile(loss='mean_absolute_error',
|
||||
optimizer=tf.keras.optimizers.Adam(0.001))
|
||||
optimizer=tf.keras.optimizers.Adam(0.001),
|
||||
metrics=[tf.keras.metrics.RootMeanSquaredError()])
|
||||
|
||||
model.fit(train_X, train_Y, verbose=0, epochs=100)
|
||||
verbose = 0 if len(verbose) == 0 else verbose[0]
|
||||
epochs = 100 if len(epochs) == 0 else epochs[0]
|
||||
model.fit(train_X, train_Y, verbose=verbose, epochs=epochs)
|
||||
|
||||
model.save('linear_regression')
|
||||
model.save('linear_regression.h5')
|
Loading…
Reference in New Issue
Block a user