This repository contains materials for a hands-on machine learning workshop focused on regression techniques for housing price prediction.
Demo-housing.ipynb- Instructor demonstration notebook using California housing data- Explains model selection rationale (Linear Regression, Decision Tree, Random Forest)
- Demonstrates leakage-safe preprocessing with
PipelineandColumnTransformer - Shows proper cross-validation and hyperparameter tuning with
GridSearchCV - Includes reproducibility best practices (
random_state=42)
Test-housing.ipynb- Student coding exercise using Melbourne housing data- TODO-driven structure with placeholders for students to fill in
- Practice preprocessing, model training, and evaluation
- No solution code included
Test-ames-optional.ipynb- Advanced optional challenge using Ames Housing dataset- For students who want extra practice
- 79 features with creative feature engineering opportunities
- Advanced techniques: skewness correction, interaction features, ensemble methods
- Evaluation on test set (no ground truth labels provided)
All datasets are located in datasets/housing/:
- California Housing (
california_data.csv) - Used in demo notebook - Melbourne Housing (
melb_data.csv) - Used in student exercise - Ames Housing (
optional/) - Used in optional challengetrain.csv- Training data with SalePricetest.csv- Test data without SalePricedata_description.txt- Detailed feature descriptions
By the end of this workshop, students will be able to:
-
Preprocess data using scikit-learn pipelines
- Handle missing values with
SimpleImputer - Scale numeric features with
RobustScaler - Encode categorical features with
OneHotEncoder
- Handle missing values with
-
Build leakage-safe ML pipelines
- Use
PipelineandColumnTransformer - Understand why pipelines prevent data leakage in cross-validation
- Use
-
Train and compare regression models
- Linear Regression (baseline)
- Decision Tree Regressor
- Random Forest Regressor
-
Evaluate models properly
- Cross-validation with
cross_val_score - Calculate RMSE (Root Mean Squared Error)
- Understand training error vs. generalization
- Cross-validation with
-
Tune hyperparameters
- Use
GridSearchCVorRandomizedSearchCV - Interpret best parameters and CV scores
- Use
-
Engineer features (optional challenge)
- Create domain-inspired features
- Handle skewed distributions
- Build interaction features
- pandas - Data manipulation and analysis
- numpy - Numerical computing
- scikit-learn - Machine learning algorithms and tools
- matplotlib - Data visualization
- jupyter - Interactive notebook environment
There are two ways to participate in this workshop. Choose the one that best fits your technical comfort level:
- Option A: Use an online environment. No installation required.
- Option B: Set up a local environment on your own computer using Git and Python.
If you don't have Python installed or want to skip the technical setup, you can run the entire workshop in your web browser using Binder.
- Open Binder: Go to https://mybinder.org/,
- Enter Repository URL: Copy and paste the
https://github.com/NUS-ISS-SS/mla-day1-workshop-studentinto the GitHub field. - Specify Branch: Type
developmentin the Git ref field. - Launch: Click the launch button below to start a temporary online session. Note:It may take 1–2 minutes to build the environment for the first time.
Once the page loads, you will see a file list. Click on Test-housing.ipynb to start your exercises.
Once you complete your exercise, you must manually save your work to your own computer and then upload the file to Canvas.
- In the Jupyter menu, go to File > Download.
- Save the
Test-housing.ipynbfile to your computer. - Rename your file to
[Your_Name]_Housing.ipynband then upload this file to Canvas.
Follow these steps to complete your assignment and submit it for grading via a Pull Request (PR).
Navigate to the main page of this repository on GitHub:
https://github.com/NUS-ISS-SS/mla-day1-workshop-student/tree/development
In the top-right corner of the page, click the Fork button.
Ensure your own GitHub account is selected as the owner. This creates a personal copy of the assignment under your account.
Open your terminal (or Git Bash) and run the following commands. Replace YOUR-USERNAME with your actual GitHub username:
git clone https://github.com/[YOUR-USERNAME]/mla-day1-workshop-student.git
cd mla-day1-workshop-studentNever work directly on the main branch. Create a new branch named after yourself:
git checkout -b feature/[your-name]-submissionWindows:
python -m venv ml-envmacOS / Linux:
python3 -m venv ml-envWindows:
ml-env\Scripts\activatemacOS / Linux:
source ml-env/bin/activateYou should see (ml-env) at the beginning of your terminal prompt once activated.
With the virtual environment activated, run:
pip install notebook numpy scipy pandas matplotlib scikit-learnjupyter notebookThis will open Jupyter in your default browser. Navigate to and open the notebook files (.ipynb) to get started.
Open the project in your preferred editor, such as VS Code.
Complete the required Python scripts or Jupyter notebooks.
Ensure your code runs locally without errors.
Once you are finished, save your work to GitHub:
git add .
git commit -m "Completed assignment: [Your Name]"
git push origin feature/[your-name]-submissionGo to your fork on GitHub, for example github.com/[YOUR-USERNAME]/mla-day1-workshop-student.
You will see a yellow banner saying: feature/[your-name]-submission had recent pushes...
Click the green Compare & pull request button.
Important: Create the Pull Request to the original repository you forked from:
https://github.com/NUS-ISS-SS/mla-day1-workshop-student/tree/development
Ensure the base repository is NUS-ISS-SS/mla-day1-workshop-student and the base branch is development.
Title your PR as: Submission-[Your Full Name].
Click Create pull request.
Once submitted, the automated GitHub Actions will trigger to run tests on your code.
If the tests fail (red X), check the logs, fix your code, and simply git push again. The PR will update automatically.
If the tests pass (green check), your submission is ready for manual review.