06-training

This commit is contained in:
Szymon Bartanowicz 2024-05-14 19:21:17 +02:00
parent 9dca2d4283
commit af6518f064
2 changed files with 23 additions and 20 deletions

39
Jenkinsfile vendored
View File

@ -1,36 +1,37 @@
pipeline {
agent any
triggers {
upstream(upstreamProjects: 'z-s464937-create-dataset', threshold: hudson.model.Result.SUCCESS)
}
parameters {
string(name: 'CUTOFF', defaultValue: '100', description: 'Ilość wierszy do odcięcia')
string(name: 'KAGGLE_USERNAME', defaultValue: '', description: 'Kaggle username')
password(name: 'KAGGLE_KEY', defaultValue: '', description: 'Kaggle API key')
string(name: 'EPOCHS', defaultValue: '10', description: 'Epochs')
buildSelector(defaultSelector: lastSuccessful(), description: 'Build no', name: 'BUILD_SELECTOR')
}
stages {
stage('Clone repo') {
stage('Clone Repository') {
steps {
git branch: "main", url: "https://git.wmi.amu.edu.pl/s464937/ium_464937"
git branch: 'training', url: "https://git.wmi.amu.edu.pl/s464937/ium_464937.git"
}
}
stage('Download and preprocess') {
environment {
KAGGLE_USERNAME = "szymonbartanowicz"
KAGGLE_KEY = "4692239eb65f20ec79f9a59ef30e67eb"
}
stage('Copy Artifacts') {
steps {
withEnv([
"KAGGLE_USERNAME=${env.KAGGLE_USERNAME}",
"KAGGLE_KEY=${env.KAGGLE_KEY}"
]) {
sh "bash ./script1.sh ${params.CUTOFF}"
}
copyArtifacts filter: 'openpowerlifting.csv', projectName: 'z-s464937-create-dataset', selector: buildParameter('BUILD_SELECTOR')
}
}
stage('Archive') {
stage("Run") {
agent {
dockerfile {
filename 'Dockerfile'
reuseNode true
}
}
steps {
archiveArtifacts artifacts: 'data/*', onlyIfSuccessful: true
sh "chmod +x ./model.py"
sh "python3 ./model.py ${params.EPOCHS}"
archiveArtifacts artifacts: 'powerlifting_model.h5', onlyIfSuccessful: true
}
}
}

View File

@ -1,3 +1,5 @@
import sys
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler, OneHotEncoder
@ -34,6 +36,6 @@ pipeline = Pipeline(steps=[
pipeline['model'].compile(optimizer='adam', loss='mse', metrics=['mae'])
pipeline.fit(X_train, y_train, model__epochs=10, model__validation_split=0.1)
pipeline.fit(X_train, y_train, model__epochs=int(sys.argv[1]), model__validation_split=0.1)
pipeline['model'].save('powerlifting_model.h5')