gitlabds 2.1.0__tar.gz → 2.1.1__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.
Files changed (26) hide show
  1. {gitlabds-2.1.0 → gitlabds-2.1.1}/PKG-INFO +7 -3
  2. {gitlabds-2.1.0 → gitlabds-2.1.1}/README.md +6 -2
  3. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/baselines.py +17 -4
  4. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/monitoring_metrics.py +8 -4
  5. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds.egg-info/PKG-INFO +7 -3
  6. {gitlabds-2.1.0 → gitlabds-2.1.1}/LICENSE +0 -0
  7. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/__init__.py +0 -0
  8. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/config_generator.py +0 -0
  9. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/dummy.py +0 -0
  10. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/feature_reduction.py +0 -0
  11. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/insights.py +0 -0
  12. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/memory_optimization.py +0 -0
  13. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/missing.py +0 -0
  14. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/missing_check.py +0 -0
  15. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/missing_fill.py +0 -0
  16. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/model_evaluator.py +0 -0
  17. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/outliers.py +0 -0
  18. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/split_data.py +0 -0
  19. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds/trends.py +0 -0
  20. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds.egg-info/SOURCES.txt +0 -0
  21. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds.egg-info/dependency_links.txt +0 -0
  22. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds.egg-info/requires.txt +0 -0
  23. {gitlabds-2.1.0 → gitlabds-2.1.1}/gitlabds.egg-info/top_level.txt +0 -0
  24. {gitlabds-2.1.0 → gitlabds-2.1.1}/setup.cfg +0 -0
  25. {gitlabds-2.1.0 → gitlabds-2.1.1}/setup.py +0 -0
  26. {gitlabds-2.1.0 → gitlabds-2.1.1}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gitlabds
3
- Version: 2.1.0
3
+ Version: 2.1.1
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.1, ks_critical=0.2, js_warning=0.05, js_critical=0.1, output_path="baseline_features.json"):`
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.1, ks_critical=0.2, js_warning=0.05, js_critical=0.1, output_path="baseline_features.json"):`
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.1,
15
- ks_critical: float = 0.2,
16
- js_warning: float = 0.05,
17
- js_critical: float = 0.1,
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', {})
@@ -258,12 +259,15 @@ 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
- if mean_shift_pct >= 20:
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:
265
269
  prediction_drift['status'] = 'critical'
266
- elif mean_shift_pct >= 10:
270
+ elif mean_shift_pct >= warning_threshold:
267
271
  prediction_drift['status'] = 'warning'
268
272
  else:
269
273
  prediction_drift['status'] = 'healthy'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gitlabds
3
- Version: 2.1.0
3
+ Version: 2.1.1
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.1, ks_critical=0.2, js_warning=0.05, js_critical=0.1, output_path="baseline_features.json"):`
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