Maha commited on
Commit
1065c08
·
1 Parent(s): bee75a7

Update README

Browse files
Files changed (1) hide show
  1. README.md +53 -5
README.md CHANGED
@@ -1,15 +1,63 @@
1
  ---
2
  license: mit
3
  ---
 
4
  # ML Assignment 3 – Maha Qaiser
5
  Dataset: California Housing from sklearn.datasets
6
- Repository: Contains the trained model for ML Assignment 3
7
 
8
  ## File Description
9
- - `best_model.joblib`: Mini-Batch Linear Regression model trained on the California Housing dataset
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- ## How to Use
 
 
 
 
 
 
 
 
 
 
 
12
  ```python
 
13
  import joblib
14
- model = joblib.load("best_model.joblib")
15
- predictions = model.predict(X_test)
 
 
 
 
 
 
1
  ---
2
  license: mit
3
  ---
4
+
5
  # ML Assignment 3 – Maha Qaiser
6
  Dataset: California Housing from sklearn.datasets
 
7
 
8
  ## File Description
9
+ - `best_model.joblib`: Mini-Batch Linear Regression model
10
+ - `scaler.joblib`: StandardScaler object to preprocess input features
11
+ - `inference.py`: Script to load the model + scaler and run predictions with user input
12
+
13
+ ## Model Overview
14
+ - **Model Type:** Mini-Batch Linear Regression
15
+ - **Features Used:**
16
+ - Avg. Rooms
17
+ - Avg. Bedrooms
18
+ - Population
19
+ - Household
20
+ - Median Income
21
+ - Latitude
22
+ - Longitude
23
+ - Housing Median Age
24
+ - **Regularization:** L2 (Ridge)
25
+ - **Early Stopping:** Applied during training
26
+
27
+ ## How to Run Inference
28
+ ### 1. Clone the repository or download the files:
29
+ ```bash
30
+ git clone https://huggingface.co/mahaqj/ml_assignment_3
31
+ cd ml_assignment_3
32
+ ```
33
+ ### 2. Install dependencies:
34
+ ```bash
35
+ pip install joblib numpy scikit-learn huggingface_hub
36
+ ```
37
+ ### 3. Run the script:
38
+ ```bash
39
+ python inference.py
40
+ ```
41
 
42
+ You’ll be prompted to enter the following features:
43
+ - Avg. Rooms
44
+ - Avg. Bedrooms
45
+ - Population
46
+ - Household
47
+ - Median Income
48
+ - Latitude
49
+ - Longitude
50
+ - Housing Median Age
51
+ The model will return the predicted housing value.
52
+
53
+ ## Loading the Model in Python
54
  ```python
55
+ from huggingface_hub import hf_hub_download
56
  import joblib
57
+
58
+ model_path = hf_hub_download(repo_id="mahaqj/ml_assignment_3", filename="best_model.joblib")
59
+ scaler_path = hf_hub_download(repo_id="mahaqj/ml_assignment_3", filename="scaler.joblib")
60
+
61
+ model = joblib.load(model_path)
62
+ scaler = joblib.load(scaler_path)
63
+ ```