>_ Jorge Uc / projects← All projects
~/projects/house-purchase // DEEP LEARNING
◆ Binary classificationTensorFlow + KerasOptuna

Predicting the decision behind a home.

An end-to-end machine learning case study exploring whether a prospective buyer decides to purchase a property. I compared neural network architectures, applied hyperparameter optimization, and rebuilt the evaluation pipeline to distinguish promising model performance from trustworthy generalization.

Archived optimized neural network training and validation curves
HISTORICAL TRAINING CURVES / ARCHIVEDML CASE STUDY
DATASET SIZE200Krecords in original study
FEATURES2319 numeric · 4 categorical
OPTIMIZATION20Optuna trials configured historically
OBJECTIVE0 / 1purchase vs no purchase
01 / THE BUSINESS QUESTION

Can we model a purchase decision?

Buying a house is not just a question of property characteristics. The dataset connects buyer, financial, and property-related variables to a binary decision outcome.

01 / PREDICTION

Binary outcome

Predict the purchase decision, not the sale price: 1 indicates purchase and 0 indicates no purchase.

02 / TABULAR DATA

Mixed features

Combine numerical and categorical inputs using a consistent preprocessing pipeline suitable for neural networks.

03 / EVIDENCE

Beyond accuracy

Evaluate generalization with appropriately separated data, class-aware metrics and explicit uncertainty about historical outputs.

02 / DATA UNDERSTANDING

200,000 observations. Two possible outcomes.

Data came from the publicly listed Global House Purchase Decision Dataset on Kaggle. No original records are redistributed from this portfolio or the accompanying repository.

DATA PROFILE

Original dataset

Records200,000
Predictors23
Numeric19
Categorical4
Excluded identifierproperty_id
Targetdecision
CLASS DISTRIBUTION

A class imbalance to account for

153,932No purchase
46,068Purchase
23.0%Positive class share

Because fewer than one in four records belong to the positive class, I use precision, recall, F1 and precision–recall AUC alongside accuracy.

03 / REPRODUCIBLE METHODOLOGY

Split first. Learn only from training data.

The public repository refactors the initial notebook into modules and fixes an important experimental weakness: preprocessing and hyperparameter decisions must not use the final test data.

01 / INPUT

Kaggle CSV

Load and validate the tabular dataset locally.

02 / HOLDOUT

70 / 10 / 20

Stratified training, validation and final test partitions.

03 / PREPROCESS

Train-only fit

Fit transformations using only the training partition.

04 / MODEL

Keras + Optuna

Train networks and tune on validation data.

05 / REPORT

Final test

Evaluate the selected model with untouched holdout data.

The repository also includes a logistic regression baseline, automated checks, saved model artifacts, and an optional local Streamlit inference interface.

04 / MODEL DEVELOPMENT

From an initial network to a tuned architecture.

The study focused on multilayer perceptrons (MLPs) for structured data. The public implementation preserves an original architecture and a historically selected optimized architecture for comparison.

REFERENCE MODEL

Logistic regression

A simpler baseline to check whether additional deep-learning complexity improves predictive performance.

Scikit-learnBenchmark
NEURAL BASELINE

Initial Keras MLP

A feed-forward network trained on encoded, scaled tabular features. Its historical learning curves are retained for inspection.

KerasTensorFlow
HISTORICAL OPTIMIZED MODEL

224 → 64 → 48 → 48

The selected hidden-layer widths from the original experiment, with dropout 0.15 and Adam learning rate approximately 0.001967.

MLPDropoutAdam
05 / HYPERPARAMETER OPTIMIZATION

Systematic searching with Optuna.

Instead of selecting network settings manually, the project uses Optuna to explore candidate configurations. The revised implementation selects parameters using validation average precision, not final test scores.

ORIGINAL EXPERIMENT

Historical tuning

The notebooks configured a 20-trial Optuna study. The exported learning curves are available, but a complete auditable trial-history database was not provided.

Important: this earlier workflow reused test data during model selection. Its reported results are historical evidence only.

REVISED EXPERIMENT

Local, repeatable trials

The GitHub version stores studies locally, keeps validation and test roles separate, and supports reproducible command-line training.

No private Optuna dashboard, DagsHub account, MLflow credentials, or access tokens are required.

06 / EXPERIMENT GALLERY

Learning curves from the original work.

These three figures come from the original notebooks. They illustrate training behavior, but the validation curves must not be interpreted as measurements from an independent untouched test set.

01 / Initial model

Historical training and validation curves for the neural baseline.

Historic baseline model learning curves
ARCHIVED OUTPUT · NOT AN UNBIASED TEST BENCHMARK

02 / Optimized model

Historical learning curves after selecting a different neural network configuration.

Historic optimized model learning curves
ARCHIVED OUTPUT · NOT AN UNBIASED TEST BENCHMARK

03 / Optuna experiment

Additional saved training curves from the optimization work.

Historic Optuna training curves
ARCHIVED OUTPUT · ORIGINAL STUDY · IMAGE DOES NOT ESTABLISH INDEPENDENT GENERALIZATION
About these plots: in the earlier notebooks, preprocessing was fitted before splitting, and the test partition was used during training/tuning. The corrected repository deliberately avoids presenting the near-perfect original scores as independently validated performance.
07 / RESULTS & LIMITATIONS

Perfect-looking metrics deserve scrutiny.

The original notebook reported an optimized confusion matrix without errors on a 40,000-row split. That result is an archived observation, not proof that the system predicts real-world home purchases with perfect accuracy.

HISTORICAL OBSERVATION

Near-perfect classification

Saved notebook outputs showed extremely high prediction scores; the split was involved in model selection, so those scores cannot serve as untouched-test evidence.

REVISED EVALUATION

Independent holdout

The new experiment reserves 20% of data for final testing and tracks precision, recall, F1, balanced accuracy, ROC AUC and average precision.

OPEN QUESTION

Shortcut features?

Ablation studies and testing across different countries or populations could reveal how much the model relies on decision-adjacent variables.

New test results are pending. The GitHub pipeline has been organized and its automated tests passed, but new TensorFlow training results on the full Kaggle dataset have not yet been produced. This page does not invent those results.
08 / PERSONAL RETROSPECTIVE

What I learned from this project.

More than optimizing a neural network, this project showed me the difference between a convincing score and a defensible machine learning experiment.

BEYOND A HIGH ACCURACY NUMBER

A model is only as credible as its evaluation protocol. Refactoring the original notebook helped turn a one-off experiment into a reproducible ML project with clear evidence, limitations and separation of responsibilities.

01 / EXPERIMENTAL DESIGN

Data leakage can invalidate success

I learned why fitting preprocessing on all rows, or repeatedly using test observations for decisions, produces overoptimistic conclusions even when the code runs correctly.

Train/validation/testGeneralization
02 / AUTOMATED OPTIMIZATION

Optuna needs the right objective

Hyperparameter tuning is useful only when it optimizes a meaningful validation metric. Class imbalance made average precision especially relevant here.

OptunaPR-AUCSearch space
03 / MACHINE LEARNING ENGINEERING

Reproducibility changes how I code

Separating data preparation, model configuration, training, reports and inference makes debugging and comparisons much easier than keeping everything inside notebooks.

Python modulesTestingCLI
04 / RESPONSIBLE INTERPRETATION

High scores need stronger questions

Unusually strong results pushed me to question feature shortcuts, dataset design, class imbalance and how predictions could change outside the sample.

Model validationCritical thinking
KEY TAKEAWAY

Better experiments are more valuable than impressive but fragile numbers.

My main takeaway was to make every stage of model development auditable: how data is split, which metric selects a model, what the test score actually measures and which conclusions remain unverified.

09 / REPOSITORY & DATA

Explore the implementation.

The public repository contains reproducible scripts, an optional interactive demo, testing utilities and documentation. Original data and all service credentials stay outside source control.

SOURCE CODE / GITHUB

Reproducible ML project

Read the README, run the pipeline, compare model architectures and inspect historical results with their limitations documented.

Explore repository ↗
PUBLIC DATA / KAGGLE

Global House Purchase Decision Dataset

Get the dataset from its original source. No buyer records are embedded in this portfolio webpage.

View dataset ↗