Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
29602e30a6 | |||
3d80335ede | |||
f6c7f5981e | |||
c0b07aaac4 | |||
979785f5b7 | |||
795b91c695 | |||
91508718a0 |
@ -2,4 +2,4 @@ FROM ubuntu:latest
|
||||
|
||||
RUN apt update && apt install -y python3-pip
|
||||
|
||||
RUN pip install pandas numpy scikit-learn tensorflow
|
||||
RUN pip install pandas numpy scikit-learn tensorflow --break-system-packages
|
49
Jenkinsfile
vendored
49
Jenkinsfile
vendored
@ -1,54 +1,45 @@
|
||||
pipeline {
|
||||
agent any
|
||||
agent {
|
||||
dockerfile true
|
||||
}
|
||||
|
||||
triggers {
|
||||
upstream(upstreamProjects: 'z-s464913-create-dataset', threshold: hudson.model.Result.SUCCESS)
|
||||
}
|
||||
|
||||
parameters {
|
||||
string (
|
||||
defaultValue: 'vskyper',
|
||||
description: 'Kaggle username',
|
||||
name: 'KAGGLE_USERNAME',
|
||||
trim: false
|
||||
)
|
||||
password (
|
||||
defaultValue: '',
|
||||
description: 'Kaggle API key',
|
||||
name: 'KAGGLE_KEY',
|
||||
buildSelector(
|
||||
defaultSelector: lastSuccessful(),
|
||||
description: 'Which build to use for copying artifacts',
|
||||
name: 'BUILD_SELECTOR'
|
||||
)
|
||||
string(name: 'LEARNING_RATE', defaultValue: '0.001', description: 'Learning rate')
|
||||
string(name: 'EPOCHS', defaultValue: '5', description: 'Number of epochs')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Clone Repository') {
|
||||
steps {
|
||||
git branch: 'main', url: 'https://git.wmi.amu.edu.pl/s464913/ium_464913.git'
|
||||
git branch: 'training', url: 'https://git.wmi.amu.edu.pl/s464913/ium_464913.git'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Download dataset') {
|
||||
stage('Copy Artifacts') {
|
||||
steps {
|
||||
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", "KAGGLE_KEY=${params.KAGGLE_KEY}"]) {
|
||||
sh 'pip install kaggle'
|
||||
sh 'kaggle datasets download -d mlg-ulb/creditcardfraud'
|
||||
sh 'unzip -o creditcardfraud.zip'
|
||||
sh 'rm creditcardfraud.zip'
|
||||
}
|
||||
copyArtifacts filter: 'data/*', projectName: 'z-s464913-create-dataset', selector: buildParameter('BUILD_SELECTOR')
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run create-dataset script') {
|
||||
agent {
|
||||
dockerfile {
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run train_model script') {
|
||||
steps {
|
||||
sh 'chmod +x create-dataset.py'
|
||||
sh 'python3 ./create-dataset.py'
|
||||
sh 'chmod +x train_model.py'
|
||||
sh "python3 ./train_model.py ${params.LEARNING_RATE} ${params.EPOCHS}"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Archive Artifacts') {
|
||||
steps {
|
||||
archiveArtifacts artifacts: 'data/*', onlyIfSuccessful: true
|
||||
archiveArtifacts artifacts: 'model/*', onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ from keras.models import Sequential
|
||||
from keras.layers import BatchNormalization, Dropout, Dense, Flatten, Conv1D
|
||||
from keras.optimizers import Adam
|
||||
import pandas as pd
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
@ -22,6 +23,9 @@ def main():
|
||||
X_train = X_train.reshape(X_train.shape[0], X_train.shape[1], 1)
|
||||
X_val = X_val.reshape(X_val.shape[0], X_val.shape[1], 1)
|
||||
|
||||
learning_rate = float(sys.argv[1])
|
||||
epochs = int(sys.argv[2])
|
||||
|
||||
model = Sequential(
|
||||
[
|
||||
Conv1D(32, 2, activation="relu", input_shape=X_train[0].shape),
|
||||
@ -38,7 +42,7 @@ def main():
|
||||
)
|
||||
|
||||
model.compile(
|
||||
optimizer=Adam(learning_rate=1e-3),
|
||||
optimizer=Adam(learning_rate=learning_rate),
|
||||
loss="binary_crossentropy",
|
||||
metrics=["accuracy"],
|
||||
)
|
||||
@ -47,7 +51,7 @@ def main():
|
||||
X_train,
|
||||
y_train,
|
||||
validation_data=(X_val, y_val),
|
||||
epochs=5,
|
||||
epochs=epochs,
|
||||
verbose=1,
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user