Update for Zadanie 6.2 - training
This commit is contained in:
parent
8567bb4c61
commit
33695102fb
24
Jenkinsfile_training
Normal file
24
Jenkinsfile_training
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {dockerfile true}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('copyArtifacts') {
|
||||||
|
steps {
|
||||||
|
copyArtifacts fingerprintArtifacts: true, projectName: 's434684-create-dataset', selector: latestSuccessful(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Sh script') {
|
||||||
|
steps {
|
||||||
|
sh 'chmod +x run_training.sh'
|
||||||
|
sh './run_training.sh ${params.LEARNING_RATE}'
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Archive artifacts') {
|
||||||
|
steps{
|
||||||
|
archiveArtifacts artifacts: 'model_movies'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
34
ium_zadanie6_training.py
Normal file
34
ium_zadanie6_training.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import tensorflow as tf
|
||||||
|
import sys
|
||||||
|
from tf.keras import layers
|
||||||
|
# from keras.layers import Flatten,Dense,Dropout, GlobalAveragePooling2D
|
||||||
|
from tf.keras.optimizers import Adam
|
||||||
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
from sklearn.metrics import mean_squared_error
|
||||||
|
|
||||||
|
movies_train = pd.read_csv('movies_train.csv')
|
||||||
|
|
||||||
|
x_train = movies_train.copy()
|
||||||
|
y_train = x_train.pop('rottentomatoes_audience_score')
|
||||||
|
x_train.pop('Unnamed: 0')
|
||||||
|
|
||||||
|
learning_rate = sys.argv[1]
|
||||||
|
|
||||||
|
model = tf.keras.Sequential()
|
||||||
|
model.add(layers.Input(shape=(22,)))
|
||||||
|
model.add(layers.Dense(64))
|
||||||
|
model.add(layers.Dense(64))
|
||||||
|
model.add(layers.Dense(32))
|
||||||
|
model.add(layers.Dense(1))
|
||||||
|
|
||||||
|
model.compile(loss='mean_absolute_error', optimizer=Adam(learning_rate))
|
||||||
|
|
||||||
|
model.fit(
|
||||||
|
x = tf.convert_to_tensor(x_train, np.float32),
|
||||||
|
y = y_train,
|
||||||
|
verbose=0, epochs=99)
|
||||||
|
|
||||||
|
model.save('model_movies')
|
||||||
|
|
||||||
|
|
2
run_training.sh
Normal file
2
run_training.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
python3 ium_zadanie6_training.py
|
Loading…
Reference in New Issue
Block a user