From 300d8a82d5c200fcf0f853bcd2e9fa871f197209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20=C5=81=C4=85czkowski?= Date: Fri, 19 Apr 2024 11:03:31 +0200 Subject: [PATCH] IUM_06 - add epochs, learning_rate and weight_decay parameters models/Jenkinsfile, update create_model.py script --- create_model.py | 9 +++++++++ models/Jenkinsfile | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/create_model.py b/create_model.py index af45a23..869c992 100644 --- a/create_model.py +++ b/create_model.py @@ -5,6 +5,7 @@ import torch.nn as nn import torch.optim as optim import os +import sys from sklearn.metrics import classification_report @@ -34,10 +35,18 @@ y_test = torch.FloatTensor(y_test).view(-1, 1) # Parameters input_size = X_train.shape[1] hidden_size = 128 + +# Default parameters learning_rate = 0.001 weight_decay = 0.001 num_epochs = 1000 +# Parameters from sys.argv +if len(sys.argv) > 1: + num_epochs = int(sys.argv[1]) + learning_rate = float(sys.argv[2]) + weight_decay = float(sys.argv[3]) + # Model initialization model = NeuralNetwork(input_size, hidden_size) diff --git a/models/Jenkinsfile b/models/Jenkinsfile index f534789..38f7b39 100644 --- a/models/Jenkinsfile +++ b/models/Jenkinsfile @@ -1,6 +1,10 @@ pipeline { agent any + parameters { + + } + stages { stage('Clone repository') { steps {