Add plot
This commit is contained in:
parent
24415420c5
commit
9b029d71a9
@ -2,7 +2,7 @@ FROM ubuntu:latest
|
|||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y python3-pip && \
|
apt-get install -y python3-pip && \
|
||||||
pip3 install kaggle pandas scikit-learn tensorflow
|
pip3 install kaggle pandas scikit-learn tensorflow matplotlib
|
||||||
|
|
||||||
RUN useradd -ms /bin/bash jenkins
|
RUN useradd -ms /bin/bash jenkins
|
||||||
|
|
||||||
@ -13,6 +13,6 @@ USER jenkins
|
|||||||
COPY data_processing.py .
|
COPY data_processing.py .
|
||||||
COPY create_model.py .
|
COPY create_model.py .
|
||||||
COPY helper.py .
|
COPY helper.py .
|
||||||
COPY predict_price.py .
|
COPY evaluate.py .
|
||||||
|
|
||||||
WORKDIR .
|
WORKDIR .
|
@ -51,7 +51,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage('CreateArtifacts') {
|
stage('CreateArtifacts') {
|
||||||
steps {
|
steps {
|
||||||
archiveArtifacts artifacts: 'hp_test_predictions.csv,hp_test_metrics.csv'
|
archiveArtifacts artifacts: 'hp_test_predictions.csv,hp_test_metrics.csv,metrics_plt.png'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
evaluate.py
18
evaluate.py
@ -5,6 +5,7 @@ import os
|
|||||||
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
|
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
|
||||||
from keras.models import load_model
|
from keras.models import load_model
|
||||||
from helper import prepare_tensors
|
from helper import prepare_tensors
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
build_number = int(sys.argv[1])
|
build_number = int(sys.argv[1])
|
||||||
|
|
||||||
@ -36,4 +37,19 @@ if os.path.isfile(metrics_file):
|
|||||||
else:
|
else:
|
||||||
updated_metrics_df = metrics_df
|
updated_metrics_df = metrics_df
|
||||||
|
|
||||||
updated_metrics_df.to_csv(metrics_file, index=False)
|
updated_metrics_df.to_csv(metrics_file, index=False)
|
||||||
|
|
||||||
|
plt.figure(figsize=(10, 6))
|
||||||
|
plt.plot(updated_metrics_df['Build_Number'], updated_metrics_df['RMSE'], label='RMSE', marker='o')
|
||||||
|
plt.plot(updated_metrics_df['Build_Number'], updated_metrics_df['MAE'], label='MAE', marker='o')
|
||||||
|
plt.plot(updated_metrics_df['Build_Number'], updated_metrics_df['R2'], label='R2', marker='o')
|
||||||
|
|
||||||
|
plt.title('Metrics vs Builds')
|
||||||
|
plt.xlabel('Build Number')
|
||||||
|
plt.ylabel('Metric Value')
|
||||||
|
plt.legend()
|
||||||
|
plt.grid(True)
|
||||||
|
|
||||||
|
plot_file = 'metrics_plt.png'
|
||||||
|
plt.savefig(plot_file)
|
||||||
|
plt.close()
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
import pandas as pd
|
|
||||||
from keras.models import load_model
|
|
||||||
from helper import prepare_tensors
|
|
||||||
|
|
||||||
hp_test = pd.read_csv('hp_test.csv')
|
|
||||||
X_test, Y_test = prepare_tensors(hp_test)
|
|
||||||
|
|
||||||
model = load_model('hp_model.h5')
|
|
||||||
|
|
||||||
test_predictions = model.predict(X_test)
|
|
||||||
|
|
||||||
predictions_df = pd.DataFrame(test_predictions, columns=["Predicted_Price"])
|
|
||||||
predictions_df.to_csv('hp_test_predictions.csv', index=False)
|
|
Loading…
Reference in New Issue
Block a user