Welcome to the House Price Prediction ML.NET project! This solution leverages machine learning to predict house prices based on features such as area, age, number of rooms, district, and price per meter. It includes both a manual ML pipeline implementation and an auto-generated model from ML.NET Model Builder.
The goal of this project is to demonstrate how to load real estate data, build and evaluate regression models, and generate predictions using both manual and automated ML workflows.
- HousePricePrediction: Contains the dataset (
dataset.csv) and shared resources. - HousePricePrediction_Manual: A manually coded ML pipeline using
FastTreeTweedieregression and evaluation metrics. - HousePricePrediction_Auto: A model auto-generated using ML.NET Model Builder for quick and easy experimentation.
- Load data from a CSV file.
- Preprocess data by replacing missing values and normalizing.
- Train a regression model using
FastTreeTweedie. - Evaluate model performance with metrics: R², MAE, MSE, RMS.
- Predict prices on unseen test data.
- Auto-generated ML pipeline using ML.NET Model Builder.
- Predict price using a single hardcoded input.
- Simpler and faster but less flexible than manual implementation.
The dataset (dataset.csv) contains information about properties:
| Index | Area | Age | Rooms | District | PricePerMeter | Price |
|---|---|---|---|---|---|---|
| 0 | 134 | 1 | 3 | 2 | 64.51 | 13400000000 |
| 1 | 58 | 10 | 1 | 2 | 64.51 | 4600000000 |
| ... | ... | ... | ... | ... | ... | ... |
Each row represents a house and its corresponding sale price.
- Load data from
dataset.csv. - Replace missing values for numerical columns.
- Concatenate features into a single vector.
- Normalize feature values.
- Train the model using FastTreeTweedie regression.
- Evaluate and output performance metrics.
- Predict and print price values for test set.
LossFn: 2.3E+17
R2 Score: 0.85
Absolute loss: 1.5E+08
Squared loss: 2.3E+17
RMS loss: 4.8E+08
- Open the solution in Visual Studio.
- Set
HousePricePrediction_Manualas the startup project. - Press
F5or run the project. - The console app will:
- Train the model.
- Print evaluation metrics.
- Predict house prices on test data and output them.
- Set
HousePricePrediction_Autoas the startup project. - Run the project to see prediction on a predefined sample input.
This project is licensed under the MIT License. Feel free to use, share, and improve it!
Pull requests and suggestions are welcome! For major changes, please open an issue first to discuss what you would like to change.


