Spaces:
Sleeping
Sleeping
atodorov284 commited on
Commit ·
da0acef
1
Parent(s): 327acb9
added data validation and ood detection
Browse files
streamlit_src/controllers/admin_controller.py
CHANGED
|
@@ -144,7 +144,7 @@ class AdminController(UserController):
|
|
| 144 |
data_without_date = data.drop(columns=["date"], errors="ignore")
|
| 145 |
|
| 146 |
if (
|
| 147 |
-
not data_without_date.
|
| 148 |
lambda x: isinstance(x, (float, int)) or pd.isna(x)
|
| 149 |
)
|
| 150 |
.all()
|
|
@@ -204,7 +204,7 @@ class AdminController(UserController):
|
|
| 204 |
ood_rows = out_of_distribution_flags.sum(axis=1)
|
| 205 |
|
| 206 |
if ood_rows.any():
|
| 207 |
-
error_message = f"Input data contains out-of-distribution values. {ood_rows.sum()} {'feature exceeds' if ood_rows.sum() == 1 else 'features exceed'} the z-score threshold.\n\n"
|
| 208 |
error_message += "Out-of-distribution values detected:\n"
|
| 209 |
|
| 210 |
ood_details = z_scores[out_of_distribution_flags]
|
|
|
|
| 144 |
data_without_date = data.drop(columns=["date"], errors="ignore")
|
| 145 |
|
| 146 |
if (
|
| 147 |
+
not data_without_date.map(
|
| 148 |
lambda x: isinstance(x, (float, int)) or pd.isna(x)
|
| 149 |
)
|
| 150 |
.all()
|
|
|
|
| 204 |
ood_rows = out_of_distribution_flags.sum(axis=1)
|
| 205 |
|
| 206 |
if ood_rows.any():
|
| 207 |
+
error_message = f"Input data contains out-of-distribution values. {ood_rows.sum()} {'feature exceeds' if ood_rows.sum() == 1 else 'features exceed'} the z-score threshold. Model prediction might be innacurate\n\n"
|
| 208 |
error_message += "Out-of-distribution values detected:\n"
|
| 209 |
|
| 210 |
ood_details = z_scores[out_of_distribution_flags]
|