Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
22d93bb82e | ||
|
29e4a67c43 | ||
|
3f4ada3b12 | ||
|
4a468eac34 |
@ -1,5 +1,6 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
import sys
|
||||||
|
|
||||||
train_data = pd.read_csv('./beer_reviews_train.csv')
|
train_data = pd.read_csv('./beer_reviews_train.csv')
|
||||||
X_train = train_data[['review_aroma', 'review_appearance', 'review_palate', 'review_taste']]
|
X_train = train_data[['review_aroma', 'review_appearance', 'review_palate', 'review_taste']]
|
||||||
@ -22,6 +23,6 @@ model.compile(optimizer='adam',
|
|||||||
loss='binary_crossentropy',
|
loss='binary_crossentropy',
|
||||||
metrics=['accuracy'])
|
metrics=['accuracy'])
|
||||||
|
|
||||||
model.fit(X_train_pad, y_train, epochs=40, batch_size=32, validation_split=0.1)
|
model.fit(X_train_pad, y_train, epochs=int(sys.argv[1]), batch_size=int(sys.argv[2]), validation_split=0.1)
|
||||||
|
|
||||||
model.save('beer_review_sentiment_model.h5')
|
model.save('beer_review_sentiment_model.h5')
|
||||||
|
42
Jenkinsfile
vendored
42
Jenkinsfile
vendored
@ -1,36 +1,25 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
upstream(upstreamProjects: 'z-s464979-create-dataset', threshold: hudson.model.Result.SUCCESS)
|
||||||
|
}
|
||||||
|
|
||||||
parameters {
|
parameters {
|
||||||
string(name: 'CUTOFF', defaultValue: '10000', description: 'Liczba wierszy do obcięcia ze zbioru danych')
|
string(name: 'EPOCHS', defaultValue: '40', description: 'Number of epochs')
|
||||||
string(name: 'KAGGLE_USERNAME', defaultValue: '', description: 'Kaggle username')
|
string(name: 'BATCH_SIZE', defaultValue: '32', description: 'Batch size')
|
||||||
password(name: 'KAGGLE_KEY', defaultValue: '', description: 'Kaggle API key')
|
buildSelector(defaultSelector: lastSuccessful(), description: 'Which build to use for copying artifacts', name: 'BUILD_SELECTOR')
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Clone Repository') {
|
stage('Clone Repository') {
|
||||||
steps {
|
steps {
|
||||||
git url: "https://git.wmi.amu.edu.pl/s464979/ium_464979"
|
git branch: 'training', url: "https://git.wmi.amu.edu.pl/s464979/ium_464979.git"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Download dataset') {
|
stage('Copy Artifacts') {
|
||||||
steps {
|
steps {
|
||||||
withEnv(["KAGGLE_USERNAME=${env.KAGGLE_USERNAME}", "KAGGLE_KEY=${env.KAGGLE_KEY}"]) {
|
copyArtifacts filter: 'beer_reviews.csv,beer_reviews_train.csv,beer_reviews_test.csv', projectName: 'z-s464979-create-dataset', selector: buildParameter('BUILD_SELECTOR')
|
||||||
sh "kaggle datasets download -d thedevastator/1-5-million-beer-reviews-from-beer-advocate --unzip"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Process and Split Dataset') {
|
|
||||||
agent {
|
|
||||||
dockerfile {
|
|
||||||
filename 'Dockerfile'
|
|
||||||
reuseNode true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
sh "chmod +x ./IUM_05-split.py"
|
|
||||||
sh "python3 ./IUM_05-split.py"
|
|
||||||
archiveArtifacts artifacts: 'beer_reviews.csv,beer_reviews_train.csv,beer_reviews_test.csv', onlyIfSuccessful: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage("Run") {
|
stage("Run") {
|
||||||
@ -42,16 +31,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
sh "chmod +x ./IUM_05-model.py"
|
sh "chmod +x ./IUM_05-model.py"
|
||||||
sh "chmod +x ./IUM_05-predict.py"
|
sh "python3 ./IUM_05-model.py ${params.EPOCHS} ${params.BATCH_SIZE}"
|
||||||
sh "python3 ./IUM_05-model.py"
|
archiveArtifacts artifacts: 'beer_review_sentiment_model.h5', onlyIfSuccessful: true
|
||||||
sh "python3 ./IUM_05-predict.py"
|
|
||||||
archiveArtifacts artifacts: 'beer_review_sentiment_model.h5,beer_review_sentiment_predictions.csv', onlyIfSuccessful: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// post {
|
|
||||||
// always {
|
|
||||||
// deleteDir()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user