A simple and educational implementation of Linear Regression using Gradient Descent from scratch with NumPy to predict house prices based on cleaned housing data. Ideal for learning machine learning fundamentals without using black-box models.
β
Load dataset from Excel
β
Handle missing values
β
Normalize features and target using StandardScaler
β
Train using batch gradient descent
β
Evaluate using Mean Squared Error (MSE)
β
Visualize training loss
Ensure you have a file named:
Cleaned_HousePricePrediction.xlsx
With:
- A sheet named Sheet1
- A SalePrice column (target variable)
- An Id column (will be dropped)
- All other columns should be numerical features
---
## π Getting Started
### 1οΈβ£ Install Dependencies
Bash
pip install pandas numpy scikit-learn matplotlib openpyxl
python your_script_name.py
---
## π Example Output
txt
MSE: 145237600.25
π Training loss plot (MSE per iteration):

---
## βοΈ Hyperparameters
You can tune the following parameters in the script:
Python
learning_rate = 0.01 # Step size for gradient descent
n_iterations = 1000 # Number of training iterations
---
## π Notes
* This is a manual implementation of linear regression; no sklearn.linear_model used.
* Both features and target variable are standardized using StandardScaler.
* Ideal for educational purposes and understanding the core of gradient-based optimization.
---
## π License
MIT License Β© 2025
Feel free to use and modify it for personal or academic use.
---
## π Contributions
Pull requests are welcome! If you'd like to improve performance, add visualization, or support other regression methods, feel free to contribute.