KatalockAi AcademyBack to KatalockAi
Phase project, required for the Phase 2 certificate

Tabular Model Shootout with Pipelines

Compare linear, kNN, tree, forest and boosting models on a real regression task using leak-proof pipelines, cross-validation, tuning and learning curves, then ship one saved pipeline you can defend.

about 5 h Reviewed against a 5-point rubric
Submit your project Get coached by Professor Katalock

Lessons this project uses

  1. 1Decision Trees and Random ForestsPhase 2: Machine learning fundamentals
  2. 2K-Nearest Neighbors and DistancesPhase 2: Machine learning fundamentals
  3. 3Model EvaluationPhase 2: Machine learning fundamentals
  4. 4Bias-Variance TradeoffPhase 2: Machine learning fundamentals
  5. 5Ensemble MethodsPhase 2: Machine learning fundamentals
  6. 6Hyperparameter TuningPhase 2: Machine learning fundamentals
  7. 7ML PipelinesPhase 2: Machine learning fundamentals

What You'll Build

A fair, reproducible model comparison on a real tabular regression problem. Every model sits inside the same scikit-learn Pipeline so preprocessing is fit per fold and nothing leaks. You compare model families with cross-validation, tune the two best with random search, use learning curves to say whether the winner is limited by bias or variance, and save the final pipeline so a separate script can load it and predict.

Requirements

  1. Dataset. Choose a public regression dataset with at least 1,000 rows and a mix of numeric and categorical columns (for example house prices, bike rentals, insurance charges, or used car prices). Explain what the target means and what an error of 1 RMSE would cost a user.
  2. Hold-out. Split off a test set (20%) with a fixed seed before any modeling. Use it once at the end.
  3. Pipeline. Build a ColumnTransformer that imputes and scales numeric columns and imputes and one-hot encodes categorical columns, wrapped with each model in a Pipeline.
  4. Model families. Compare at least five with 5-fold cross-validation on the training data: a mean predictor baseline, Ridge, kNN regressor, a decision tree, a random forest, and a gradient boosting model. Report mean and std of RMSE, MAE and R^2 per model in a table.
  5. Tuning. Run RandomizedSearchCV (at least 20 trials, cross-validated) on the two best families. Report the best parameters and how much CV RMSE improved over defaults.
  6. Bias and variance. For the tuned winner, plot a learning curve (train vs validation error as training size grows) to results/learning_curve.png and a validation curve over one complexity parameter (for example max_depth or n_neighbors) to results/validation_curve.png. State whether the model is bias limited or variance limited and what you would do next.
  7. Final test. Refit the tuned winner on all training data, evaluate once on the test set, and compare test RMSE with its CV RMSE.
  8. Interpretation. Compute permutation importance on the test set and list the top 5 features.
  9. Ship it. Save the fitted pipeline with joblib to models/final_pipeline.joblib (gitignored if over 50 MB), and write predict.py that loads it, reads a CSV of raw rows, and prints predictions. Show that predictions from the reloaded pipeline match the in-memory ones exactly.
  10. Save all numbers to results/metrics.json; one command reruns the full experiment.

Constraints

  • scikit-learn, pandas, NumPy and matplotlib only (XGBoost or LightGBM allowed but not required). Free public data.
  • CPU only; keep the full run under 15 minutes on a laptop. Subsample to at most 50,000 rows with a fixed seed if needed, and set n_jobs sensibly.

Stretch Goals

  • Add a stacking or voting ensemble and see if it beats the single winner.
  • Use nested cross-validation to estimate how optimistic the tuned CV score is.
  • Log each run's parameters and scores to a CSV or MLflow as an experiment tracker.

How to Submit

Public GitHub repo with README.md, train.py (or src/), predict.py, requirements.txt, a data download script or instructions, a small sample_input.csv, and results/ with metrics.json, learning_curve.png and validation_curve.png. The README must give run commands, your CV comparison table, tuned parameters, the final test numbers vs CV, your bias or variance diagnosis, the top features, the limitations of the model, and one experiment that did not help.

How It's Reviewed

Professor Katalock reads your repository and the evidence you paste, and scores each criterion out of 100. You pass with a weighted total of 70 or more and no criterion below 40. A copied or padded submission is flagged and fails.

CriterionWeightHow it's checked
Fair, leak-free evaluation25Test set is split before modeling and used once; all preprocessing lives in a ColumnTransformer inside each Pipeline evaluated with 5-fold CV; a mean predictor baseline is included; metrics.json has mean and std of RMSE, MAE and R^2 for at least five models.
Tuning and diagnosis20RandomizedSearchCV with at least 20 trials is run on two model families with best params and improvement reported; learning_curve.png and validation_curve.png exist and the README draws a bias or variance conclusion consistent with them.
Final results and shipping20Pasted output shows final test RMSE next to CV RMSE, permutation importance top 5, and predict.py loading the saved pipeline on sample_input.csv with predictions identical to the in-memory model.
Code quality15Training and prediction are separate scripts, seeds and config values are centralized, one command reproduces metrics.json, and large artifacts or data are not committed.
README explanation and reflection20README explains the dataset and what RMSE means in its units, shows the learner's own comparison table and tuned results, discusses the CV vs test gap, states limitations, and describes an experiment that did not help.

Submit

Push your work to a public GitHub repository with a README that explains how to run it, then paste the evidence below. Up to 3 reviews a day, free.

  • Link to the public GitHub repo
  • Full terminal output of `python train.py`
  • Output of `python predict.py sample_input.csv` including the reload match check
  • Contents of results/metrics.json
  • The learning_curve.png and validation_curve.png plots

Reviews are done by AI against the rubric above. They check the evidence in your repository; they are not a substitute for a human code review, and a review can be wrong. If you think it is, improve the README so the evidence is unmistakable and resubmit.