Skip to main content

House Price Prediction package

Project description

Median housing value prediction

The housing data can be downloaded from https://raw.githubusercontent.com/ageron/handson-ml/master/. The script has codes to download the data. We have modelled the median house value on given housing data.

The following techniques have been used:

  • Linear regression
  • Decision Tree
  • Random Forest

Steps performed

  • We prepare and clean the data. We check and impute for missing values.
  • Features are generated and the variables are checked for correlation.
  • Multiple sampling techinuqies are evaluated. The data set is split into train and test.
  • All the above said modelling techniques are tried and evaluated. The final metric used to evaluate is mean squared error.

Project Description

● Created new issue in github repo.

● Created a new branch to make the required changes related to the issue specified.

● Fixed bugs to make the python executable run.

● Added comments to the changes made to the existing code to make others understand the fixes.

● Created a conda environment to execute the python code.

How to run the code:

Command to create an environment from the env.yml file you have generated.

conda env create -f env.yml

Command to create an environment from the env.yml file you have generated.

conda activate mle-dev

Command to run the python scripts.

1. Run the ingest_data.py file

python3 src/HousePricePrediction_dakshinm/ingest_data.py

If necessary include the arguments like this

python3 src/HousePricePrediction_dakshinm/ingest_data.py --output data/raw --logs-folder logs --log-level DEBUG

REFER BELOW DOCUMENTATION FOR OTHER OPTIONS AS WELL:

Download dataset from source and creates train and test datasets

options: -h, --help show this help message and exit

--output OUTPUT Output folder path where dataset will be stored.

--logs-folder LOGS_FOLDER Output folder path where logs are recorded

--log-level LOG_LEVEL Specify the log level (default: DEBUG)

--no-console-log Toggle whether or not to write logs to the console (default:False)

2. Run the train.py file

python3 src/HousePricePrediction_dakshinm/train.py

If necessary include the arguments like this

python3 src/HousePricePrediction_dakshinm/train.py --input data/processed --output artifacts/ --logs-folder logs --log-level DEBUG

REFER BELOW DOCUMENTATION FOR OTHER OPTIONS AS WELL:

usage: train.py [-h] [--input INPUT] [--output OUTPUT] [--logs-folder LOGS_FOLDER] [--log-level LOG_LEVEL] [--no-console-log]

Train the model(s).

options: -h, --help show this help message and exit

--input INPUT Input folder path where dataset is stored.

--output OUTPUT Output folder path where trained model(s) will be stored.

--logs-folder LOGS_FOLDER Output folder path where logs are recorded

--log-level LOG_LEVEL Specify the log level (default: DEBUG)

--no-console-log Toggle whether or not to write logs to the console (default:False)

3. Run the score.py file

python3 src/HousePricePrediction_dakshinm/score.py

If necessary include the arguments like this

python3 src/HousePricePrediction_dakshinm/score.py --input_data data/processed

--input_pickle_folder artifacts/ --logs-folder logs --log-level DEBUG

REFER BELOW DOCUMENTATION FOR OTHER OPTIONS AS WELL:

usage: score.py [-h] [--input_data INPUT_DATA] [--input_pickle_folder INPUT_PICKLE_FOLDER] [--logs-folder LOGS_FOLDER] [--log-level LOG_LEVEL] [--no-console-log]

Score the model(s).

options: -h, --help show this help message and exit

--input_data INPUT_DATA Input folder path where dataset(s) is stored.

--input_pickle_folder INPUT_PICKLE_FOLDER Input folder path where pickle file(s) are stored.

--logs-folder LOGS_FOLDER Output folder path where logs are recorded

--log-level LOG_LEVEL Specify the log level (default: DEBUG)

--no-console-log Toggle whether or not to write logs to the console (default:False)

How to package the code:

Step 1 : python -m build

Step 2 : This will create a .tar.gz and .whl file in the dist folder.

Step 3 : Install the package from the .whl file by running the command below

pip install dist/HousePricePrediction_dakshinm-1.4.1-py3-none-any.whl

or

pip install -i https://test.pypi.org/simple/ HousePricePrediction-dakshinm==1.4.1

How to run the test files:

Step 1 : Check if the installation of packages is successful by running the command below.

pytest tests/functional_tests/test_installation.py

Step 2 : Run the unit test cases for the files.

python3 -m unittest tests/unit_tests/test_data_ingestion.py

python3 -m unittest tests/unit_tests/test_train.py

python3 -m unittest tests/unit_tests/test_score.py

Step 3 : Run the functional test cases.

pytest tests/functional_tests/test_functional_tests.py

Where to find logs?:

Logs can be found in the logs/ folder inside the mle-training folder.

How to create documentations using Sphinx:

Step 1: Run the command : pip install sphinx

Step 2: Run the command : sphinx-quickstart

Step 3: Run the command : sphinx-apidoc -o docs/source/ src/

        This will make the docstrings as html documents

Step 4: Run the command : sphinx-build -b html docs/source docs/build

        This will create the html docs in the build folder

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

HousePricePrediction_dakshinm-1.4.1.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

HousePricePrediction_dakshinm-1.4.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file HousePricePrediction_dakshinm-1.4.1.tar.gz.

File metadata

File hashes

Hashes for HousePricePrediction_dakshinm-1.4.1.tar.gz
Algorithm Hash digest
SHA256 14527d074924a2a45bd86a5d9f381d95752dbea16dcbff1e23549538ea19f246
MD5 18906ac057a07b58737a391a17f6a392
BLAKE2b-256 d0ba179652b1bb3958e6c630674cee9b45bc072f3079686f931acb8c1e251e02

See more details on using hashes here.

File details

Details for the file HousePricePrediction_dakshinm-1.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for HousePricePrediction_dakshinm-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 889c5601bbc23c343abf55a4eab3b0b1a9fcb15d628b82c544122d7ecfa693f4
MD5 856e334e4326d2eb909209f89076fb72
BLAKE2b-256 04844deeb8382f31191cd3b8320bad41b9d16ab638c309f3b25559619ea29b78

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page