{"id":30673051,"url":"https://github.com/bala179/housing-prices-prediction","last_synced_at":"2025-09-01T05:40:55.669Z","repository":{"id":291292487,"uuid":"359211910","full_name":"Bala179/housing-prices-prediction","owner":"Bala179","description":"A small project to predict housing prices by training against a sample dataset.","archived":false,"fork":false,"pushed_at":"2021-04-19T13:11:05.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-03T17:37:29.279Z","etag":null,"topics":["data-science","machine-learning","regression"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bala179.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-18T17:36:24.000Z","updated_at":"2021-07-26T12:18:59.000Z","dependencies_parsed_at":"2025-05-03T17:47:41.311Z","dependency_job_id":null,"html_url":"https://github.com/Bala179/housing-prices-prediction","commit_stats":null,"previous_names":["bala179/housing-prices-prediction"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Bala179/housing-prices-prediction","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bala179%2Fhousing-prices-prediction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bala179%2Fhousing-prices-prediction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bala179%2Fhousing-prices-prediction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bala179%2Fhousing-prices-prediction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bala179","download_url":"https://codeload.github.com/Bala179/housing-prices-prediction/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bala179%2Fhousing-prices-prediction/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273077227,"owners_count":25041358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","machine-learning","regression"],"created_at":"2025-09-01T05:40:51.586Z","updated_at":"2025-09-01T05:40:55.620Z","avatar_url":"https://github.com/Bala179.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Predicting Housing Prices\nThis is my first ML project, which uses the simple 'boston' dataset in sklearn and aims to build a model to predict housing prices from the data in this dataset.\n\n## Loading Data\nData is first loaded using the `load_boston()` method in `sklearn.datasets` and converted to a pandas DataFrame. The contents of the dataset are examined using the `head()` function and it is also checked for missing values (in this case there are none). Then the features and the target variable (in this case, MEDV - the median value of owner-occupied homes in $1000’s) are then separated.\n\n## Training the models\nThe estimators that I have used have made use of *pipelines*, that is, estimators making use of a number of sub-steps chained together. This makes it possible to use the new, compund, estimator in cross-validation (remember that, if you are scaling the data, you would need to fit the scaler on the *training data* only, this can be done in cross-validation using a pipeline). I tried 3 different models to make predictions - linear regression, polynomial ridge regression and support vector regression. In the last 2 models I used `GridSearchCV` with 5 folds to find the best set of parameters - additionally, I had to perform a train-test split for these 2 cases, so that a portion of unseen data is available for testing the model at the end. Since linear regression has no hyperparameters to tune, I simply used `cross_val_score()` with 5 folds to fit and evaluate the model, without any train-test splitting. (Note: Because of shuffling in the K-Fold cross-validation, the results of the program may vary.)\n\nThe scoring metric which I used is R\u003csup\u003e2\u003c/sup\u003e, which should be as close to 1 as possible for a good fit to the data. In the first case, the mean R\u003csup\u003e2\u003c/sup\u003e was evaluated by taking the mean of the 5 cross-validation scores; in the other 2 cases, it was evaluated using the best found parameter(s) on the unseen test data.\n\n# Conclusion\nNone of the models got a perfect R\u003csup\u003e2\u003c/sup\u003e of 1; however, the best score (among the 3 models) of around 0.85 was found for **polynomial ridge regression with alpha = 3 and degree of polynomial = 2** (in one execution of the program - the result may vary if it is run again).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbala179%2Fhousing-prices-prediction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbala179%2Fhousing-prices-prediction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbala179%2Fhousing-prices-prediction/lists"}