Spaces:
Sleeping
Sleeping
Update pages/Linear Regression.py
Browse files- pages/Linear Regression.py +33 -7
pages/Linear Regression.py
CHANGED
|
@@ -59,14 +59,40 @@ st.markdown("""
|
|
| 59 |
- **No multicollinearity**: Independent variables aren't too correlated
|
| 60 |
""")
|
| 61 |
|
| 62 |
-
# Metrics
|
| 63 |
st.markdown("### 📏 Evaluation Metrics")
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
# Visualization and Prediction Explanation
|
| 72 |
st.markdown("### 📉 Visual Representation")
|
|
|
|
| 59 |
- **No multicollinearity**: Independent variables aren't too correlated
|
| 60 |
""")
|
| 61 |
|
|
|
|
| 62 |
st.markdown("### 📏 Evaluation Metrics")
|
| 63 |
+
|
| 64 |
+
with st.expander("1️⃣ Mean Absolute Error (MAE)"):
|
| 65 |
+
st.latex(r"MAE = \frac{1}{n} \sum_{i=1}^{n} \left| y_i - \hat{y}_i \right|")
|
| 66 |
+
st.markdown("""
|
| 67 |
+
- Measures the average magnitude of errors.
|
| 68 |
+
- It’s easy to understand and not sensitive to outliers.
|
| 69 |
+
- **Lower MAE = better model**.
|
| 70 |
+
""")
|
| 71 |
+
|
| 72 |
+
with st.expander("2️⃣ Mean Squared Error (MSE)"):
|
| 73 |
+
st.latex(r"MSE = \frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2")
|
| 74 |
+
st.markdown("""
|
| 75 |
+
- Measures average of squared errors.
|
| 76 |
+
- Penalizes larger errors more than MAE.
|
| 77 |
+
- Sensitive to outliers.
|
| 78 |
+
""")
|
| 79 |
+
|
| 80 |
+
with st.expander("3️⃣ Root Mean Squared Error (RMSE)"):
|
| 81 |
+
st.latex(r"RMSE = \sqrt{\frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2}")
|
| 82 |
+
st.markdown("""
|
| 83 |
+
- Square root of MSE.
|
| 84 |
+
- Interpreted in the same units as the output variable.
|
| 85 |
+
- Also penalizes large errors.
|
| 86 |
+
""")
|
| 87 |
+
|
| 88 |
+
with st.expander("4️⃣ R² Score (Coefficient of Determination)"):
|
| 89 |
+
st.latex(r"R^2 = 1 - \frac{\sum (y_i - \hat{y}_i)^2}{\sum (y_i - \bar{y})^2}")
|
| 90 |
+
st.markdown("""
|
| 91 |
+
- Indicates how much variance in the target is explained by the model.
|
| 92 |
+
- Ranges from **0 to 1** (sometimes negative if the model is worse than the mean).
|
| 93 |
+
- **Closer to 1 = better model**.
|
| 94 |
+
""")
|
| 95 |
+
|
| 96 |
|
| 97 |
# Visualization and Prediction Explanation
|
| 98 |
st.markdown("### 📉 Visual Representation")
|