spb/wp3_uqo Public
UQO Working Paper No. 3 — Hedonic housing price models for the US: parametric, quantile, and machine-learning approaches.
TeX 77.8%
Python 22.1%
1# Author: Simon-Pierre Boucher — contact@spboucher.ai2#3"""Project paths and analysis constants.45All paths are derived from the repository root so the pipeline can be run6from any working directory. Override the data location by setting the7environment variable ``WP3_ROOT`` before running any script.8"""910import os11from pathlib import Path1213PROJECT_ROOT = Path(os.environ.get("WP3_ROOT", Path(__file__).resolve().parents[2]))1415DATA_RAW = PROJECT_ROOT / "data" / "raw"16DATA_PROCESSED = PROJECT_ROOT / "data" / "processed"17RESULTS_DIR = PROJECT_ROOT / "results"18FIGURES_DIR = PROJECT_ROOT / "figures"1920DUCKDB_PATH = DATA_RAW / "us_housing.duckdb"21ANALYTICAL_SAMPLE = DATA_PROCESSED / "analytical_sample.pkl"22MODEL_DATA = DATA_PROCESSED / "model_data.pkl"23SHAP_DATA = DATA_PROCESSED / "shap_data.pkl"2425# Reproducibility26RANDOM_STATE = 4227QR_STABILITY_SEEDS = [42, 100, 200, 300, 400, 500, 600, 700, 800, 900]28QR_SUBSAMPLE_SIZE = 150_0002930# States held out entirely in the geographic-validation exercise31HOLDOUT_STATES = ["CA", "NY", "TX", "FL", "OH", "CO", "NC", "WA", "IL", "GA"]3233# Feature blocks (raw, unstandardized names in analytical_sample)34STRUCTURAL_FEATS = ["ln_sqft", "bedrooms", "bathrooms", "age", "age_sq", "stories",35 "bath_per_bed", "sqft_per_bed"]36LOT_FEATS = ["ln_lot"]37AMENITY_FEATS = ["has_pool", "has_spa", "has_basement", "has_fireplace", "has_garage",38 "on_waterfront", "has_central_air", "has_forced_air", "has_hardwood",39 "parking_spaces", "luxury_score"]40NEIGHBORHOOD_FEATS = ["walk_score", "bike_score", "transit_score", "avg_school_rating",41 "school_count", "nearest_school_distance", "property_tax_rate"]42MARKET_FEATS = ["is_condo", "has_hoa", "ln_hoa", "tag_new_construction", "tag_foreclosure"]43INTERACTION_FEATS = ["sqft_x_age", "pool_x_south", "waterfront_x_sqft", "basement_x_north",44 "condo_x_walkscore", "age_x_luxury"]4546ALL_BASE_FEATS = (STRUCTURAL_FEATS + LOT_FEATS + AMENITY_FEATS + NEIGHBORHOOD_FEATS +47 MARKET_FEATS + INTERACTION_FEATS)4849CATEGORICAL_COLS = ["roof_cat", "construction_cat", "foundation_cat", "region"]5051# Variables tracked in the quantile-regression robustness exercises52KEY_VARS = ["ln_sqft", "bedrooms", "bathrooms", "age", "age_sq",53 "ln_lot", "has_pool", "has_garage", "luxury_score",54 "tag_foreclosure", "on_waterfront", "region_Northeast", "region_West"]55