This commit is contained in:
Kacper Dudzic 2022-04-24 22:51:54 +02:00
parent 780eb5d964
commit f5a2673e07
2 changed files with 18 additions and 12 deletions

9
Jenkinsfile vendored
View File

@ -2,6 +2,13 @@ pipeline {
agent {
dockerfile true
}
parameters {
string(
defaultValue: '100',
description: 'Example training parameter',
name: 'EPOCHS_NUM'
)
}
stages {
stage('Stage 1') {
steps {
@ -10,7 +17,7 @@ pipeline {
sh 'python3 process_dataset.py'
echo 'Dataset processed'
echo 'Conducting simple regression model test'
sh 'python3 simple_regression.py'
sh 'python3 simple_regression.py $EPOCHS_NUM'
echo 'Model predictions saved'
sh 'head lego_linreg_results.csv'
}

View File

@ -44,18 +44,11 @@ history = model.fit(
validation_split=0.2
)
# Prosta ewaluacja
test_results = {'model': model.evaluate(
test_piece_counts,
test_prices, verbose=0)
}
# Wykonanie wielu predykcji
x = tf.linspace(100, 7000, 6901)
y = model.predict(x)
# Wykonanie predykcji na danych ze zbioru testującego
y_pred = model.predict(test_piece_counts)
# Zapis predykcji do pliku
results = pd.DataFrame({"input_piece_count": x.numpy().tolist(), "predicted_price": [a[0] for a in y.tolist()]})
results = pd.DataFrame({"test_set_piece_count": test_piece_counts.numpy().tolist(), "predicted_price": [a[0] for a in y_pred.tolist()]})
results.to_csv(r'lego_reg_results.csv', index=False, header=True)
# Zapis modelu do pliku
@ -63,6 +56,12 @@ model.save('lego_reg_model')
# Opcjonalne statystyki, wykresy
'''
# Prosta ewaluacja
test_results = {'model': model.evaluate(
test_piece_counts,
test_prices, verbose=0)
}
print(test_results)
hist = pd.DataFrame(history.history)
@ -70,7 +69,7 @@ hist['epoch'] = history.epoch
print(hist.tail())
plt.scatter(train_piece_counts, train_prices, label='Data')
plt.plot(x, y, color='k', label='Predictions')
plt.plot(x, y_pred, color='k', label='Predictions')
plt.xlabel('pieces')
plt.ylabel('price')
plt.legend()