model-diagnostics 1.4.1__tar.gz → 1.4.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.
Files changed (43) hide show
  1. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/PKG-INFO +1 -1
  2. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/__about__.py +1 -1
  3. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_utils/binning.py +10 -6
  4. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_utils/tests/test_binning.py +1 -1
  5. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/calibration/identification.py +20 -10
  6. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/calibration/plots.py +20 -10
  7. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/.codecov.yml +0 -0
  8. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/.gitignore +0 -0
  9. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/LICENSE +0 -0
  10. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/README.md +0 -0
  11. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/Untitled.ipynb +0 -0
  12. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/dev_tools/print_package_versions.py +0 -0
  13. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/docs/development.md +0 -0
  14. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/docs/examples/classification.ipynb +0 -0
  15. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/docs/examples/quantile_regression.ipynb +0 -0
  16. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/docs/examples/regression_on_workers_compensation.ipynb +0 -0
  17. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/docs/gen_ref_pages.py +0 -0
  18. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/docs/index.md +0 -0
  19. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/docs/javascripts/mathjax.js +0 -0
  20. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/mkdocs.yml +0 -0
  21. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/pyproject.toml +0 -0
  22. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/__init__.py +0 -0
  23. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_config.py +0 -0
  24. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_utils/__init__.py +0 -0
  25. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_utils/array.py +0 -0
  26. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_utils/isotonic.py +0 -0
  27. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_utils/partial_dependence.py +0 -0
  28. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_utils/plot_helper.py +0 -0
  29. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_utils/test_helper.py +0 -0
  30. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_utils/tests/test_array.py +0 -0
  31. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_utils/tests/test_isotonic.py +0 -0
  32. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/_utils/tests/test_partial_dependence.py +0 -0
  33. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/calibration/__init__.py +0 -0
  34. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/calibration/tests/__init__.py +0 -0
  35. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/calibration/tests/test_identification.py +0 -0
  36. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/calibration/tests/test_plots.py +0 -0
  37. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/scoring/__init__.py +0 -0
  38. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/scoring/plots.py +0 -0
  39. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/scoring/scoring.py +0 -0
  40. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/scoring/tests/__init__.py +0 -0
  41. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/scoring/tests/test_plots.py +0 -0
  42. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/scoring/tests/test_scoring.py +0 -0
  43. {model_diagnostics-1.4.1 → model_diagnostics-1.4.2}/src/model_diagnostics/tests/test_config.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: model-diagnostics
3
- Version: 1.4.1
3
+ Version: 1.4.2
4
4
  Summary: Tools for diagnostics and assessment of (machine learning) models
5
5
  Project-URL: Homepage, https://lorentzenchr.github.io/model-diagnostics/
6
6
  Project-URL: Source, https://github.com/lorentzenchr/model-diagnostics
@@ -14,4 +14,4 @@
14
14
  # Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
15
15
  # 'X.Y.dev0' is the canonical version of 'X.Y.dev'
16
16
  #
17
- __version__ = "1.4.1"
17
+ __version__ = "1.4.2"
@@ -30,7 +30,7 @@ def bin_feature(
30
30
  feature_name: Optional[Union[int, str]],
31
31
  n_obs: int,
32
32
  n_bins: int = 10,
33
- bin_method: str = "quantile",
33
+ bin_method: str = "sturges",
34
34
  ):
35
35
  """Helper function to bin features of different dtypes.
36
36
 
@@ -45,11 +45,15 @@ def bin_feature(
45
45
  n_obs : int
46
46
  The expected length of the first dimention of feature.
47
47
  n_bins : int
48
- The number of bins, at least 2, for numerical features and the maximal number
49
- of (most frequent) categories shown for categorical features. Due to ties, the
50
- effective number of bins might be smaller than `n_bins`. Null values are always
51
- included in the output, accounting for one bin. NaN values are treated as null
52
- values.
48
+ The number of bins, at least 2. For numerical features, `n_bins` only applies
49
+ when `bin_method` is set to `"quantile"` or `"uniform"`.
50
+ For string-like and categorical features, the most frequent values are taken.
51
+ Ties are dealt with by taking the first value in natural sorting order.
52
+ The remaining values are merged into `"other n"` with `n` indicating the unique
53
+ count.
54
+
55
+ I present, null values are always included in the output, accounting for one
56
+ bin. NaN values are treated as null values.
53
57
  bin_method : str
54
58
  The method to use for finding bin edges (boundaries). Options are:
55
59
 
@@ -146,7 +146,7 @@ def test_binning_numerical(bin_method, with_inf, with_null, feature_type):
146
146
 
147
147
 
148
148
  def test_binning_auto():
149
- """ "Test auto bin method"""
149
+ """Test auto bin method"""
150
150
  n_bins = 5
151
151
  feature = pl.Series(name="my_feature", values=[0, 1, 1, 2])
152
152
  n_obs = len(feature)
@@ -130,7 +130,7 @@ def compute_bias(
130
130
  functional: str = "mean",
131
131
  level: float = 0.5,
132
132
  n_bins: int = 10,
133
- bin_method: str = "auto",
133
+ bin_method: str = "sturges",
134
134
  ):
135
135
  r"""Compute generalised bias conditional on a feature.
136
136
 
@@ -172,10 +172,15 @@ def compute_bias(
172
172
  `level=0.5` and `functional="expectile"` gives the mean.
173
173
  `level=0.5` and `functional="quantile"` gives the median.
174
174
  n_bins : int
175
- The number of bins for numerical features and the maximal number of (most
176
- frequent) categories shown for categorical features. Due to ties, the effective
177
- number of bins might be smaller than `n_bins`. Null values are always included
178
- in the output, accounting for one bin. NaN values are treated as null values.
175
+ The number of bins, at least 2. For numerical features, `n_bins` only applies
176
+ when `bin_method` is set to `"quantile"` or `"uniform"`.
177
+ For string-like and categorical features, the most frequent values are taken.
178
+ Ties are dealt with by taking the first value in natural sorting order.
179
+ The remaining values are merged into `"other n"` with `n` indicating the unique
180
+ count.
181
+
182
+ I present, null values are always included in the output, accounting for one
183
+ bin. NaN values are treated as null values.
179
184
  bin_method : str
180
185
  The method for finding bin edges (boundaries). Options using `n_bins` are:
181
186
 
@@ -483,7 +488,7 @@ def compute_marginal(
483
488
  weights: Optional[npt.ArrayLike] = None,
484
489
  *,
485
490
  n_bins: int = 10,
486
- bin_method: str = "auto",
491
+ bin_method: str = "sturges",
487
492
  n_max: int = 1000,
488
493
  rng: Optional[Union[np.random.Generator, int]] = None,
489
494
  ):
@@ -512,10 +517,15 @@ def compute_marginal(
512
517
  Case weights. If given, the bias is calculated as weighted average of the
513
518
  identification function with these weights.
514
519
  n_bins : int
515
- The number of bins for numerical features and the maximal number of (most
516
- frequent) categories shown for categorical features. Due to ties, the effective
517
- number of bins might be smaller than `n_bins`. Null values are always included
518
- in the output, accounting for one bin. NaN values are treated as null values.
520
+ The number of bins, at least 2. For numerical features, `n_bins` only applies
521
+ when `bin_method` is set to `"quantile"` or `"uniform"`.
522
+ For string-like and categorical features, the most frequent values are taken.
523
+ Ties are dealt with by taking the first value in natural sorting order.
524
+ The remaining values are merged into `"other n"` with `n` indicating the unique
525
+ count.
526
+
527
+ I present, null values are always included in the output, accounting for one
528
+ bin. NaN values are treated as null values.
519
529
  bin_method : str
520
530
  The method for finding bin edges (boundaries). Options using `n_bins` are:
521
531
 
@@ -319,7 +319,7 @@ def plot_bias(
319
319
  functional: str = "mean",
320
320
  level: float = 0.5,
321
321
  n_bins: int = 10,
322
- bin_method: str = "auto",
322
+ bin_method: str = "sturges",
323
323
  confidence_level: float = 0.9,
324
324
  ax: Optional[mpl.axes.Axes] = None,
325
325
  ):
@@ -365,10 +365,15 @@ def plot_bias(
365
365
  `level=0.5` and `functional="expectile"` gives the mean.
366
366
  `level=0.5` and `functional="quantile"` gives the median.
367
367
  n_bins : int
368
- The number of bins for numerical features and the maximal number of (most
369
- frequent) categories shown for categorical features. Due to ties, the effective
370
- number of bins might be smaller than `n_bins`. Null values are always included
371
- in the output, accounting for one bin. NaN values are treated as null values.
368
+ The number of bins, at least 2. For numerical features, `n_bins` only applies
369
+ when `bin_method` is set to `"quantile"` or `"uniform"`.
370
+ For string-like and categorical features, the most frequent values are taken.
371
+ Ties are dealt with by taking the first value in natural sorting order.
372
+ The remaining values are merged into `"other n"` with `n` indicating the unique
373
+ count.
374
+
375
+ I present, null values are always included in the output, accounting for one
376
+ bin. NaN values are treated as null values.
372
377
  bin_method : str
373
378
  The method for finding bin edges (boundaries). Options using `n_bins` are:
374
379
 
@@ -742,7 +747,7 @@ def plot_marginal(
742
747
  weights: Optional[npt.ArrayLike] = None,
743
748
  *,
744
749
  n_bins: int = 10,
745
- bin_method: str = "auto",
750
+ bin_method: str = "sturges",
746
751
  n_max: int = 1000,
747
752
  rng: Optional[Union[np.random.Generator, int]] = None,
748
753
  ax: Optional[mpl.axes.Axes] = None,
@@ -773,10 +778,15 @@ def plot_marginal(
773
778
  Case weights. If given, the bias is calculated as weighted average of the
774
779
  identification function with these weights.
775
780
  n_bins : int
776
- The number of bins for numerical features and the maximal number of (most
777
- frequent) categories shown for categorical features. Due to ties, the effective
778
- number of bins might be smaller than `n_bins`. Null values are always included
779
- in the output, accounting for one bin. NaN values are treated as null values.
781
+ The number of bins, at least 2. For numerical features, `n_bins` only applies
782
+ when `bin_method` is set to `"quantile"` or `"uniform"`.
783
+ For string-like and categorical features, the most frequent values are taken.
784
+ Ties are dealt with by taking the first value in natural sorting order.
785
+ The remaining values are merged into `"other n"` with `n` indicating the unique
786
+ count.
787
+
788
+ I present, null values are always included in the output, accounting for one
789
+ bin. NaN values are treated as null values.
780
790
  bin_method : str
781
791
  The method for finding bin edges (boundaries). Options using `n_bins` are:
782
792