gitlabds 2.1.0__tar.gz → 2.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gitlabds-2.1.0 → gitlabds-2.1.2}/PKG-INFO +7 -3
- {gitlabds-2.1.0 → gitlabds-2.1.2}/README.md +6 -2
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/baselines.py +17 -4
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/monitoring_metrics.py +16 -11
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds.egg-info/PKG-INFO +7 -3
- {gitlabds-2.1.0 → gitlabds-2.1.2}/LICENSE +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/__init__.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/config_generator.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/dummy.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/feature_reduction.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/insights.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/memory_optimization.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/missing.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/missing_check.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/missing_fill.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/model_evaluator.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/outliers.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/split_data.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds/trends.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds.egg-info/SOURCES.txt +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds.egg-info/dependency_links.txt +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds.egg-info/requires.txt +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/gitlabds.egg-info/top_level.txt +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/setup.cfg +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/setup.py +0 -0
- {gitlabds-2.1.0 → gitlabds-2.1.2}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gitlabds
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.2
|
|
4
4
|
Summary: Gitlab Data Science and Modeling Tools
|
|
5
5
|
Home-page: https://gitlab.com/gitlab-data/gitlabds
|
|
6
6
|
Author: Kevin Dietz
|
|
@@ -764,7 +764,7 @@ results = gitlabds.prescriptions(
|
|
|
764
764
|
#### Description
|
|
765
765
|
Generate baseline feature distributions, importance scores, and drift thresholds in a single comprehensive artifact for model monitoring.
|
|
766
766
|
|
|
767
|
-
`gitlabds.generate_baseline_features(training_data, feature_importance_df, importance_method="shapley_values", n_bins=10, psi_warning=0.1, psi_critical=0.2, ks_warning=0.
|
|
767
|
+
`gitlabds.generate_baseline_features(training_data, feature_importance_df, importance_method="shapley_values", n_bins=10, psi_warning=0.1, psi_critical=0.2, ks_warning=0.2, ks_critical=0.3, js_warning=0.1, js_critical=0.2, output_path="baseline_features.json"):`
|
|
768
768
|
|
|
769
769
|
#### Parameters:
|
|
770
770
|
- **_training_data_** : Training feature data DataFrame
|
|
@@ -818,8 +818,10 @@ Generate baseline calibration data with train + test curves, prediction statisti
|
|
|
818
818
|
- **_test_actuals_** : Test set actual binary outcomes (0/1)
|
|
819
819
|
- **_model_configuration_** : Dictionary of model configuration parameters
|
|
820
820
|
- **_n_bins_** : Number of bins for calibration curve (default: 10)
|
|
821
|
+
- **_prediction_drift_warning_** : Warning level for prediction score drift (default: 0.10),
|
|
822
|
+
- **_prediction_drift_critical_** : Critical level for prediction score drift (default: 0.20),
|
|
821
823
|
- **_output_path_** : Path to save the JSON file
|
|
822
|
-
|
|
824
|
+
|
|
823
825
|
#### Returns
|
|
824
826
|
- None (saves baseline calibration to JSON file)
|
|
825
827
|
|
|
@@ -835,6 +837,8 @@ gitlabds.generate_baseline_calibration(
|
|
|
835
837
|
test_predictions=y_test_pred,
|
|
836
838
|
test_actuals=y_test,
|
|
837
839
|
model_configuration=model_config,
|
|
840
|
+
prediction_drift_warning=0.15,
|
|
841
|
+
prediction_drift_critical=0.25
|
|
838
842
|
output_path="model_baseline_calibration.json"
|
|
839
843
|
)
|
|
840
844
|
```
|
|
@@ -744,7 +744,7 @@ results = gitlabds.prescriptions(
|
|
|
744
744
|
#### Description
|
|
745
745
|
Generate baseline feature distributions, importance scores, and drift thresholds in a single comprehensive artifact for model monitoring.
|
|
746
746
|
|
|
747
|
-
`gitlabds.generate_baseline_features(training_data, feature_importance_df, importance_method="shapley_values", n_bins=10, psi_warning=0.1, psi_critical=0.2, ks_warning=0.
|
|
747
|
+
`gitlabds.generate_baseline_features(training_data, feature_importance_df, importance_method="shapley_values", n_bins=10, psi_warning=0.1, psi_critical=0.2, ks_warning=0.2, ks_critical=0.3, js_warning=0.1, js_critical=0.2, output_path="baseline_features.json"):`
|
|
748
748
|
|
|
749
749
|
#### Parameters:
|
|
750
750
|
- **_training_data_** : Training feature data DataFrame
|
|
@@ -798,8 +798,10 @@ Generate baseline calibration data with train + test curves, prediction statisti
|
|
|
798
798
|
- **_test_actuals_** : Test set actual binary outcomes (0/1)
|
|
799
799
|
- **_model_configuration_** : Dictionary of model configuration parameters
|
|
800
800
|
- **_n_bins_** : Number of bins for calibration curve (default: 10)
|
|
801
|
+
- **_prediction_drift_warning_** : Warning level for prediction score drift (default: 0.10),
|
|
802
|
+
- **_prediction_drift_critical_** : Critical level for prediction score drift (default: 0.20),
|
|
801
803
|
- **_output_path_** : Path to save the JSON file
|
|
802
|
-
|
|
804
|
+
|
|
803
805
|
#### Returns
|
|
804
806
|
- None (saves baseline calibration to JSON file)
|
|
805
807
|
|
|
@@ -815,6 +817,8 @@ gitlabds.generate_baseline_calibration(
|
|
|
815
817
|
test_predictions=y_test_pred,
|
|
816
818
|
test_actuals=y_test,
|
|
817
819
|
model_configuration=model_config,
|
|
820
|
+
prediction_drift_warning=0.15,
|
|
821
|
+
prediction_drift_critical=0.25
|
|
818
822
|
output_path="model_baseline_calibration.json"
|
|
819
823
|
)
|
|
820
824
|
```
|
|
@@ -11,10 +11,10 @@ def generate_baseline_features(
|
|
|
11
11
|
# Drift thresholds (integrated)
|
|
12
12
|
psi_warning: float = 0.1,
|
|
13
13
|
psi_critical: float = 0.2,
|
|
14
|
-
ks_warning: float = 0.
|
|
15
|
-
ks_critical: float = 0.
|
|
16
|
-
js_warning: float = 0.
|
|
17
|
-
js_critical: float = 0.
|
|
14
|
+
ks_warning: float = 0.2,
|
|
15
|
+
ks_critical: float = 0.3,
|
|
16
|
+
js_warning: float = 0.1,
|
|
17
|
+
js_critical: float = 0.2,
|
|
18
18
|
output_path: str = "baseline_features.json"
|
|
19
19
|
) -> None:
|
|
20
20
|
"""
|
|
@@ -218,6 +218,8 @@ def generate_baseline_calibration(
|
|
|
218
218
|
test_actuals: np.ndarray,
|
|
219
219
|
model_configuration: Dict[str, Any],
|
|
220
220
|
n_bins: int = 10,
|
|
221
|
+
prediction_drift_warning: float = 0.10,
|
|
222
|
+
prediction_drift_critical: float = 0.20,
|
|
221
223
|
output_path: str = "baseline_calibration.json"
|
|
222
224
|
) -> None:
|
|
223
225
|
"""
|
|
@@ -238,6 +240,10 @@ def generate_baseline_calibration(
|
|
|
238
240
|
Dictionary of model configuration parameters (e.g., {'f1_threshold': 0.15})
|
|
239
241
|
n_bins : int
|
|
240
242
|
Number of bins for calibration curve (default: 10)
|
|
243
|
+
prediction_drift_warning: float (default: 0.10)
|
|
244
|
+
Warning level for prediction score drift
|
|
245
|
+
prediction_drift_critical: float (default: 0.20)
|
|
246
|
+
Critical level for prediction score drift
|
|
241
247
|
output_path : str
|
|
242
248
|
Path to save the JSON file
|
|
243
249
|
|
|
@@ -323,6 +329,13 @@ def generate_baseline_calibration(
|
|
|
323
329
|
},
|
|
324
330
|
"prediction_statistics": prediction_statistics,
|
|
325
331
|
"model_configuration": model_configuration,
|
|
332
|
+
"drift_thresholds": {
|
|
333
|
+
"prediction_drift": {
|
|
334
|
+
"warning": prediction_drift_warning,
|
|
335
|
+
"critical": prediction_drift_critical,
|
|
336
|
+
"description": "Mean prediction shift percentage from baseline"
|
|
337
|
+
}
|
|
338
|
+
},
|
|
326
339
|
"metadata": {
|
|
327
340
|
"n_bins": n_bins,
|
|
328
341
|
"train_sample_size": len(train_predictions),
|
|
@@ -55,6 +55,7 @@ def calculate_monitoring_metrics(
|
|
|
55
55
|
baseline_features = baseline_features_data.get('baseline_features', {})
|
|
56
56
|
feature_importance_data = baseline_features_data.get('feature_importance', {})
|
|
57
57
|
drift_thresholds = baseline_features_data.get('drift_thresholds', {})
|
|
58
|
+
prediction_drift_thresholds = baseline_calibration_data.get('drift_thresholds', {}).get('prediction_drift', {})
|
|
58
59
|
|
|
59
60
|
baseline_calibration = baseline_calibration_data.get('calibration_curves', {})
|
|
60
61
|
model_configuration = baseline_calibration_data.get('model_configuration', {})
|
|
@@ -128,8 +129,8 @@ def calculate_monitoring_metrics(
|
|
|
128
129
|
'model_name': model_name,
|
|
129
130
|
'sub_model': sub_model,
|
|
130
131
|
'model_version': model_version,
|
|
131
|
-
'feature_name': feature_name,
|
|
132
132
|
'scoring_date': scoring_date.strftime('%Y-%m-%d %H:%M:%S'),
|
|
133
|
+
'feature_name': feature_name,
|
|
133
134
|
'psi_value': psi_value,
|
|
134
135
|
'feature_importance': feat_importance,
|
|
135
136
|
'status': status
|
|
@@ -258,18 +259,22 @@ def calculate_monitoring_metrics(
|
|
|
258
259
|
if baseline_std is not None:
|
|
259
260
|
prediction_drift['std_shift'] = float(current_std - baseline_std)
|
|
260
261
|
prediction_drift['std_shift_pct'] = float((current_std - baseline_std) / baseline_std * 100) if baseline_std > 0 else None
|
|
261
|
-
|
|
262
|
-
# Determine prediction drift status
|
|
262
|
+
|
|
263
|
+
# Determine prediction drift status using configurable thresholds
|
|
263
264
|
mean_shift_pct = abs(prediction_drift.get('mean_shift_pct', 0))
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
265
|
+
critical_threshold = prediction_drift_thresholds.get('critical', 0.25)
|
|
266
|
+
warning_threshold = prediction_drift_thresholds.get('warning', 0.15)
|
|
267
|
+
|
|
268
|
+
if mean_shift_pct >= critical_threshold:
|
|
269
|
+
prediction_drift_status = 'critical'
|
|
270
|
+
elif mean_shift_pct >= warning_threshold:
|
|
271
|
+
prediction_drift_status = 'warning'
|
|
268
272
|
else:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
+
prediction_drift_status = 'healthy'
|
|
274
|
+
|
|
275
|
+
else:
|
|
276
|
+
prediction_drift_status = 'unknown'
|
|
277
|
+
|
|
273
278
|
|
|
274
279
|
# =================================================================
|
|
275
280
|
# 4. CREATE OUTPUT DATAFRAMES
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gitlabds
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.2
|
|
4
4
|
Summary: Gitlab Data Science and Modeling Tools
|
|
5
5
|
Home-page: https://gitlab.com/gitlab-data/gitlabds
|
|
6
6
|
Author: Kevin Dietz
|
|
@@ -764,7 +764,7 @@ results = gitlabds.prescriptions(
|
|
|
764
764
|
#### Description
|
|
765
765
|
Generate baseline feature distributions, importance scores, and drift thresholds in a single comprehensive artifact for model monitoring.
|
|
766
766
|
|
|
767
|
-
`gitlabds.generate_baseline_features(training_data, feature_importance_df, importance_method="shapley_values", n_bins=10, psi_warning=0.1, psi_critical=0.2, ks_warning=0.
|
|
767
|
+
`gitlabds.generate_baseline_features(training_data, feature_importance_df, importance_method="shapley_values", n_bins=10, psi_warning=0.1, psi_critical=0.2, ks_warning=0.2, ks_critical=0.3, js_warning=0.1, js_critical=0.2, output_path="baseline_features.json"):`
|
|
768
768
|
|
|
769
769
|
#### Parameters:
|
|
770
770
|
- **_training_data_** : Training feature data DataFrame
|
|
@@ -818,8 +818,10 @@ Generate baseline calibration data with train + test curves, prediction statisti
|
|
|
818
818
|
- **_test_actuals_** : Test set actual binary outcomes (0/1)
|
|
819
819
|
- **_model_configuration_** : Dictionary of model configuration parameters
|
|
820
820
|
- **_n_bins_** : Number of bins for calibration curve (default: 10)
|
|
821
|
+
- **_prediction_drift_warning_** : Warning level for prediction score drift (default: 0.10),
|
|
822
|
+
- **_prediction_drift_critical_** : Critical level for prediction score drift (default: 0.20),
|
|
821
823
|
- **_output_path_** : Path to save the JSON file
|
|
822
|
-
|
|
824
|
+
|
|
823
825
|
#### Returns
|
|
824
826
|
- None (saves baseline calibration to JSON file)
|
|
825
827
|
|
|
@@ -835,6 +837,8 @@ gitlabds.generate_baseline_calibration(
|
|
|
835
837
|
test_predictions=y_test_pred,
|
|
836
838
|
test_actuals=y_test,
|
|
837
839
|
model_configuration=model_config,
|
|
840
|
+
prediction_drift_warning=0.15,
|
|
841
|
+
prediction_drift_critical=0.25
|
|
838
842
|
output_path="model_baseline_calibration.json"
|
|
839
843
|
)
|
|
840
844
|
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|