This commit is contained in:
AWieczarek 2024-05-05 19:01:35 +02:00
parent 4a468eac34
commit 3f4ada3b12
2 changed files with 9 additions and 5 deletions

View File

@ -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=sys.argv[1], batch_size=sys.argv[2], validation_split=0.1)
model.save('beer_review_sentiment_model.h5') model.save('beer_review_sentiment_model.h5')

11
Jenkinsfile vendored
View File

@ -1,10 +1,13 @@
pipeline { pipeline {
agent any agent any
triggers {
upstream(upstreamProjects: 'z-s464979-create-datase', 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') buildSelector(defaultSelector: lastSuccessful(), description: 'Which build to use for copying artifacts', name: 'BUILD_SELECTOR')
} }
@ -28,7 +31,7 @@ pipeline {
} }
steps { steps {
sh "chmod +x ./IUM_05-model.py" sh "chmod +x ./IUM_05-model.py"
sh "python3 ./IUM_05-model.py" sh "python3 ./IUM_05-model.py ${params.EPOCHS} ${params.BATCH_SIZE}"
archiveArtifacts artifacts: 'beer_review_sentiment_model.h5', onlyIfSuccessful: true archiveArtifacts artifacts: 'beer_review_sentiment_model.h5', onlyIfSuccessful: true
} }
} }