Deployed with Docker. Run in CLI: docker pull enoshima/tokyo_project:latest
- after that command, run:
docker run --name tokyo_container -d -p 8085:8080 enoshima/tokyo_project:latest - If current ports are already used, then: first one is port which will be displayed and second one is the
port specified in theDockerfile. Hence change first one to match to another port. - open the site in the browser or click
open in browserin Docker client. - Visit All properties tab, click Get approx. .. . Then tweak, if one wishes, params and click Predict.
- Alternatively, visit Additional actions -> Calculate approx. ..
Deprecated: was deployed with AWS, but due to expenses removed it
Deployed with AWS EB: put in browser tokyo-ml.eba-qjriabzm.us-west-2.elasticbeanstalk.com.
- however, for the time being I didn't manage to fix static files issue
=>it works without propercss
This is a project that resembles real-estate site.
It's built:
- with Django on backend
- dynamic templates with Bootstrap/HTML/CSS on the frontend
- as a DB I used Sqlite and for model creation: in-built Django-ORM
- considering Machine Learning part, I used Sklearn to build 2 models
- CRUD for users/posts/APIs
- Custom data loader from pandas to inject data from exisitng file
- 2 ML models to predict price from prefilled or bare form
- Special form for posts bulk delete
- APIs for users/posts/profile
- Myraid of Unit Tests to improve quality
- For compatibility I used pipenv + requirements.txt with Docker
generalis the base folder that has base template and code to handle CRUD for postsusershas CRUD for users with signals to create Profileprediction_pricehas code to enable prediction and here deployed ML models
are implemented via Interface and Compositiondata_loaderis a folder with mine-created tool to load data from Pandas into the modelML_modelsis a folder where you can find:- 2
.binmodels for production - notebooks where I did all the data preparation and machine learning
- zip dataset
train.pyto train 2 final models. It's done with interfaces and for speed up I used multiprocessing.
- 2
-
Machine Learning models are done via Sklearn where first model is
Ridge()and second isDecision Tree Regressor() -
Models are done via
MainInterface()to enable loose-coupling and easy addition of other models.
Two models, in turn, are augmeneted via Composition byRegression()class.
Also in these 2 classes there are model unpacking and function to trigger prediction which is done in thatRegression()class. -
Regression()class will do data transformation and prediction itself -
In
Jupyter notebooksyou can observe model creation. Inreal_estate_sklearn.ipynbthere is linear regression
implemented via a) bare numpy & python b) Sklearn. Inreal_estate_dt_rf.ipynbthere isDTRvia Sklearn. -
I left on purpose
.env(as it's not a production level) where you can findsecret_keyrequired for app to work.
- For the base I used this dataset: https://www.kaggle.com/nishiodens/japan-real-estate-transaction-prices
- Then I trimmed it and did all the preparations. Processed dataset can be seen in ML_models both "zipped" and ".csv"
.
├── Dockerfile
├── ML_models
│ ├── decision_tree_model.bin
│ ├── real_estate_dt_rf.ipynb
│ ├── real_estate_processed.csv.zip
│ ├── real_estate_regression.ipynb
│ ├── regression_model.bin
│ └── train.py
├── Pipfile
├── Pipfile.lock
├── README.md
├── api
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── migrations
│ │ ├── __init__.py
│ ├── models.py
│ ├── serializers.py
│ ├── tests
│ │ ├── __init__.py
│ │ └── test_view.py
│ ├── urls.py
│ └── views.py
├── data_loader
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── injection_class.py
│ ├── migrations
│ │ ├── __init__.py
│ ├── models.py
│ ├── static
│ │ └── data_loader
│ │ └── make_load.css
│ ├── templates
│ │ └── data_loader
│ │ └── make_load.html
│ ├── tests
│ │ ├── __init__.py
│ │ └── test_view.py
│ └── views.py
├── db.sqlite3
├── general
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── migrations
│ │ ├── 0001_initial.py
│ │ ├── 0002_propertyclass_can_add_posts.py
│ │ ├── 0003_auto_20210830_1043.py
│ │ ├── 0004_propertyclass_age.py
│ │ ├── 0005_alter_propertyclass_age.py
│ │ ├── 0006_alter_propertyclass_image.py
│ │ ├── 0007_auto_20210907_1102.py
│ │ ├── __init__.py
│ ├── models.py
│ ├── static
│ │ ├── favicon
│ │ │ ├── android-chrome-192x192.png
│ │ │ ├── android-chrome-512x512.png
│ │ │ ├── apple-touch-icon.png
│ │ │ ├── browserconfig.xml
│ │ │ ├── favicon-16x16.png
│ │ │ ├── favicon-32x32.png
│ │ │ ├── favicon.ico
│ │ │ ├── mstile-150x150.png
│ │ │ ├── safari-pinned-tab.svg
│ │ │ └── site.webmanifest
│ │ └── general
│ │ ├── all_properties.css
│ │ ├── delete_all_posts.css
│ │ ├── delete_post.css
│ │ ├── form_css.css
│ │ ├── main.css
│ │ ├── pages_img
│ │ │ ├── delete_page.jpg
│ │ │ └── sunflower.jpg
│ │ └── update_post.css
│ ├── templates
│ │ └── general
│ │ ├── all_properties.html
│ │ ├── create_post.html
│ │ ├── delete_all_posts.html
│ │ ├── delete_post.html
│ │ ├── single_post.html
│ │ ├── start_page.html
│ │ ├── update_post.html
│ │ └── user_posts.html
│ ├── tests
│ │ ├── __init__.py
│ │ ├── test_forms.py
│ │ ├── test_model.py
│ │ └── test_views.py
│ ├── urls.py
│ └── views.py
├── manage.py
├── media
│ ├── avatar.jpg
│ ├── default_property.jpg
│ ├── propery_photo
│ │ ├── 8183BF8F-F393-4B12-9B6F-4147A616FFF9.JPG
│ └── user_photo
│ ├── 6pu7Us-dDlk.jpg
├── notes.txt
├── prediction_price
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── forms.py
│ ├── migrations
│ │ ├── __init__.py
│ ├── models.py
│ ├── prediction_interface.py
│ ├── prediction_model.py
│ ├── static
│ │ └── prediction_price
│ │ ├── form_css.css
│ │ └── price_result.css
│ ├── templates
│ │ └── prediction_price
│ │ ├── prediction_result.html
│ │ └── price_prediction.html
│ ├── tests
│ │ ├── __init__.py
│ │ ├── test_form.py
│ │ └── test_view.py
│ └── views.py
├── requirements.txt
├── tokyo_real_estate
│ ├── __init__.py
│ ├── asgi.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
└── users
├── __init__.py
├── admin.py
├── apps.py
├── decorators.py
├── forms.py
├── migrations
│ ├── 0001_initial.py
│ ├── 0002_auto_20210830_1016.py
│ ├── 0003_profile_can_add_posts.py
│ ├── 0004_alter_profile_id.py
│ ├── __init__.py
├── models.py
├── signals.py
├── static
│ └── users
│ ├── delete_acc.css
│ ├── login.css
│ ├── logout.css
│ ├── pages_img
│ │ ├── delete_account.jpg
│ │ ├── logout_page.jpg
│ │ └── profile_page.jpg
│ ├── password_reset.css
│ ├── profile.css
│ └── register.css
├── templates
│ └── users
│ ├── all_users.html
│ ├── delete_account.html
│ ├── login.html
│ ├── logout.html
│ ├── password_reset.html
│ ├── profile_page.html
│ └── register.html
├── tests
│ ├── __init__.py
│ ├── test_decorators.py
│ ├── test_form.py
│ ├── test_model.py
│ ├── test_signals.py
│ └── test_views.py
└── views.py