项目作者: rpnugroho

项目描述 :
Predict house price using Keras functional API.
高级语言: Python
项目地址: git://github.com/rpnugroho/house-price-multi-input.git
创建时间: 2021-02-15T10:26:12Z
项目社区:https://github.com/rpnugroho/house-price-multi-input

开源协议:

下载


House Price Prediction

Predict house price with multiple input: structured data and images.\
Image of demo

Dataset

All dataset can be obtain from this repository.\
The dataset contains 535 instances, 4 images for each house and a text file. Each row in text file represents number of bedrooms, bathrooms, area of the house, zipcode and the price.\
We map all images and create a CSV file. We also remove rare zipcode and outliers from the dataset. You can see this process in data preparation notebook.

Model

We use Keras Functional API and some experimental feature in preprocessing layers.\
There are 5 extractor model, 1 MLP to handle structured data and 4 CNN to handle image data. We concat all outputs from this extractor and create predictions.
Image of architecture
\
After training for 150 epochs we got MAPE 27% on validation data. You can see this process in modeling notebook.

Deployment

We use TensorFlow Serving to deploy our model.

  1. docker pull tensorflow/serving:latest
  2. docker run -p 8501:8501 \
  3. --name tfserving_house_price \
  4. --mount type=bind, \
  5. source=PATH/house-price-multi-input/models/, \
  6. target=/models/house-price/ \
  7. -e MODEL_NAME=house-price \
  8. -t tensorflow/serving

and create prediction using this script.

  1. INSTANCES = {
  2. 'area': [area],
  3. 'bathrooms': [bathrooms],
  4. 'bedrooms': [bedrooms],
  5. 'zipcode': [zipcode],
  6. 'img_frontal': [img_frontal],
  7. 'img_bedroom': [img_bedroom],
  8. 'img_kitchen': [img_kitchen],
  9. 'img_bathroom': [img_bathroom]
  10. }
  11. curl -X POST \
  12. http://localhost:8501/v1/models/house-price:predict \
  13. -d "{"signature_name": "serving_default", "instances": [INSTANCES]}"

Demo

We also create app demo using streamlit:

  1. streamlit run app.py

Reference