From acbeaf5638eacea27f80e0af2113ff410cfbd4c0 Mon Sep 17 00:00:00 2001 From: Karolina Oparczyk Date: Mon, 17 May 2021 21:36:02 +0200 Subject: [PATCH] epochs parameter --- JenkinsfileNeural | 13 ++++++++----- neural_network.py | 4 ++-- neural_network.sh | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/JenkinsfileNeural b/JenkinsfileNeural index bc4413a..3664fd7 100644 --- a/JenkinsfileNeural +++ b/JenkinsfileNeural @@ -5,7 +5,11 @@ node { parameters([ buildSelector(defaultSelector: lastSuccessful(), description: 'Which build to use for copying artifacts', - name: 'BUILD_SELECTOR') + name: 'BUILD_SELECTOR'), + string(defaultValue: '30', + description: 'Amount of epochs', + name: 'EPOCHS', + trim: false), ]) ] ) @@ -18,24 +22,23 @@ node { copyArtifacts fingerprintArtifacts: true, projectName: 's434765-create-dataset', selector: buildParameter("BUILD_SELECTOR") sh ''' #!/usr/bin/env bash - chmod 777 neural_network.sh + chmod 777 neural_network.sh ${params.KAGGLE_USERNAME} ./neural_network.sh | tee output.txt ''' archiveArtifacts 'output.txt' archiveArtifacts 'model/**/*.*' } - emailext body: 'Successful build', + emailext body: 's434765', subject: "Successful build", to: "26ab8f35.uam.onmicrosoft.com@emea.teams.ms" } } catch (e) { - emailext body: 'Failed build', + emailext body: 's434765', subject: "Failed build", to: "26ab8f35.uam.onmicrosoft.com@emea.teams.ms" throw e } } } - \ No newline at end of file diff --git a/neural_network.py b/neural_network.py index 40b8062..d3ffe28 100644 --- a/neural_network.py +++ b/neural_network.py @@ -3,7 +3,7 @@ import numpy as np from sklearn.metrics import mean_squared_error from tensorflow import keras - +import sys def normalize_data(data): return (data - np.min(data)) / (np.max(data) - np.min(data)) @@ -40,7 +40,7 @@ model = keras.Sequential([ model.compile(loss='mean_absolute_error', optimizer="Adam", metrics=['mean_absolute_error']) -model.fit(X, y, epochs=30, validation_split = 0.3) +model.fit(X, y, epochs=int(sys.argv[1]), validation_split = 0.3) data = pd.read_csv("data_dev", sep=',', error_bad_lines=False, skip_blank_lines=True, nrows=527, names=["video_id", "last_trending_date", diff --git a/neural_network.sh b/neural_network.sh index 5124db6..134abd4 100755 --- a/neural_network.sh +++ b/neural_network.sh @@ -1,2 +1,2 @@ #!/bin/bash -python3 neural_network.py \ No newline at end of file +python3 neural_network.py $1 \ No newline at end of file