Predict values
This commit is contained in:
parent
aa08c7feae
commit
6ccc678bd8
@ -29,6 +29,11 @@ pipeline {
|
||||
copyArtifacts projectName: 'z487183-create-dataset'
|
||||
sh './prepare-stats.sh'
|
||||
archiveArtifacts 'stats.txt'
|
||||
sh 'python3 property_model.py'
|
||||
sh 'python3 predict_values.py'
|
||||
archiveArtifacts 'test_predictions.csv'
|
||||
archiveArtifacts 'train_predictions.csv'
|
||||
archiveArtifacts 'dev_predictions.csv'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ RUN apt-get install -y python3 python3-pip unzip
|
||||
RUN pip install pandas
|
||||
RUN pip install scikit-learn
|
||||
RUN pip install kaggle
|
||||
RUN pip install keras
|
||||
RUN pip install tensorflow
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
|
38
predict_values.py
Normal file
38
predict_values.py
Normal file
@ -0,0 +1,38 @@
|
||||
import pandas as pd
|
||||
from tensorflow import keras
|
||||
import csv
|
||||
|
||||
model = keras.models.load_model('model.h5')
|
||||
X_test = pd.read_csv('X_test.csv').values
|
||||
X_train = pd.read_csv('X_train.csv').values
|
||||
X_val = pd.read_csv('X_val.csv').values
|
||||
|
||||
with open('test_predictions.csv', "a") as file:
|
||||
writer = csv.writer(file)
|
||||
predictions = model.predict(X_test)
|
||||
writer.writerow(['PredictedPriceAboveMedian'])
|
||||
for pred in predictions:
|
||||
result = [0]
|
||||
if pred[0] > 0.5:
|
||||
result = [1]
|
||||
writer.writerow(result)
|
||||
|
||||
with open('train_predictions.csv', "a") as file:
|
||||
writer = csv.writer(file)
|
||||
predictions = model.predict(X_train)
|
||||
writer.writerow(['PredictedPriceAboveMedian'])
|
||||
for pred in predictions:
|
||||
result = [0]
|
||||
if pred[0] > 0.5:
|
||||
result = [1]
|
||||
writer.writerow(result)
|
||||
|
||||
with open('dev_predictions.csv', "a") as file:
|
||||
writer = csv.writer(file)
|
||||
predictions = model.predict(X_val)
|
||||
writer.writerow(['PredictedPriceAboveMedian'])
|
||||
for pred in predictions:
|
||||
result = [0]
|
||||
if pred[0] > 0.5:
|
||||
result = [1]
|
||||
writer.writerow(result)
|
Loading…
Reference in New Issue
Block a user