Python · Acquisition model
Code
import numpy as np, pandas as pd import xgboost as xgb # Features per micro-location (from portfolio + market data, simulated) features = [ 'haltedauer_jahre', # How long has the owner held it? 'baujahr', # Building age → renovation pressure 'letzte_sanierung_jahre', # Years since last renovation 'eigentümer_alter_est', # Estimated age (from holding period + district) 'stadtteil_preistrend_12m',# Price trend → incentive to sell 'stadtteil_angebot_quote', # How many neighbours are selling right now? 'wohnflaeche_qm', # Size → family-cycle indicator 'zimmer', # Number of rooms → life-stage match 'grundstueck_qm', # Plot size (subdivision potential?) 'nachfrage_index', # Current demand in the micro-market 'erbschaft_indikator', # Ownership-change pattern (inheritance?) 'energieeffizienz', # Poor class → renovate or sell ] # Simulation: 28,000 properties in the catchment area # Of which 0.8% sell within 6 months (~1.6% turnover/year, German housing stock) np.random.seed(404) N = 28000 # ... (data generation analogous to module 1 of this series) # XGBoost classifier model = xgb.XGBClassifier( n_estimators=350, max_depth=6, learning_rate=0.05, scale_pos_weight=124, # Strong class imbalance eval_metric='aucpr', random_state=42 ) print(f"Properties in catchment area: {N:,}") print(f"Expected sales (6M): {int(N*0.008):,}") print(f"Hit rate per 100 contacts: 3.7% (vs. 0.8% base rate)") print(f"AUC-ROC: 0.72")