sliceline 0.2.14__tar.gz → 0.2.15__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sliceline
3
- Version: 0.2.14
3
+ Version: 0.2.15
4
4
  Summary: ✂️ Fast slice finding for Machine Learning model debugging.
5
5
  Home-page: https://github.com/DataDome/sliceline
6
6
  License: BSD-3-Clause
@@ -61,7 +61,7 @@ for a more thorough tutorial:
61
61
  🛠 Installation
62
62
  ---------------
63
63
 
64
- Sliceline is intended to work with **Python 3.7 or above**. Installation
64
+ Sliceline is intended to work with **Python 3.9 or above**. Installation
65
65
  can be done with ``pip``:
66
66
 
67
67
  .. code:: sh
@@ -41,7 +41,7 @@ for a more thorough tutorial:
41
41
  🛠 Installation
42
42
  ---------------
43
43
 
44
- Sliceline is intended to work with **Python 3.7 or above**. Installation
44
+ Sliceline is intended to work with **Python 3.9 or above**. Installation
45
45
  can be done with ``pip``:
46
46
 
47
47
  .. code:: sh
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "sliceline"
7
- version = "0.2.14" # This version is a generic placeholder. It should not be changed.
7
+ version = "0.2.15" # This version is a generic placeholder. It should not be changed.
8
8
  description = "✂️ Fast slice finding for Machine Learning model debugging."
9
9
  authors = ["Antoine de Daran"]
10
10
  readme = "README.rst"
@@ -22,7 +22,7 @@ scipy = "^1.12"
22
22
  black = "^24"
23
23
  flake8 = "^6"
24
24
  jupyter = "^1.0.0"
25
- matplotlib = "^3.8"
25
+ matplotlib = "^3.9"
26
26
  nbconvert = "^6.5.0"
27
27
  optbinning = "^0.15.0"
28
28
  pandas = "^1.5"
@@ -378,7 +378,11 @@ class Slicefinder(BaseEstimator, TransformerMixin):
378
378
  slice_candidates = x_encoded @ slices.T == level
379
379
  slice_sizes = slice_candidates.sum(axis=0).A[0]
380
380
  slice_errors = errors @ slice_candidates
381
- max_slice_errors = slice_candidates.T.multiply(errors).max(axis=1).A
381
+ # Here we can't use the .A shorthand because it is not
382
+ # implemented in all scipy versions for coo_matrix objects
383
+ max_slice_errors = (
384
+ slice_candidates.T.multiply(errors).max(axis=1).toarray()
385
+ )
382
386
 
383
387
  # score of relative error and relative size
384
388
  slice_scores = self._score(
@@ -397,7 +401,11 @@ class Slicefinder(BaseEstimator, TransformerMixin):
397
401
  """Initialise 1-slices, i.e. slices with one predicate."""
398
402
  slice_sizes = x_encoded.sum(axis=0).A[0]
399
403
  slice_errors = errors @ x_encoded
400
- max_slice_errors = x_encoded.T.multiply(errors).max(axis=1).A[:, 0]
404
+ # Here we can't use the .A shorthand because it is not
405
+ # implemented in all scipy versions for coo_matrix objects
406
+ max_slice_errors = (
407
+ x_encoded.T.multiply(errors).max(axis=1).toarray()[:, 0]
408
+ )
401
409
 
402
410
  # working set of active slices (#attr x #slices) and top-k
403
411
  valid_slices_mask = (slice_sizes >= self.min_sup) & (slice_errors > 0)
@@ -440,7 +448,9 @@ class Slicefinder(BaseEstimator, TransformerMixin):
440
448
  ) -> np.ndarray:
441
449
  """Join compatible slices according to `level`."""
442
450
  slices_int = slices.astype(int)
443
- join = (slices_int @ slices_int.T).A == level - 2
451
+ # Here we can't use the .A shorthand because it is not
452
+ # implemented in all scipy versions for coo_matrix objects
453
+ join = (slices_int @ slices_int.T).toarray() == level - 2
444
454
  return np.triu(join, 1) * join
445
455
 
446
456
  @staticmethod
@@ -503,7 +513,10 @@ class Slicefinder(BaseEstimator, TransformerMixin):
503
513
  sub_pair_candidates = pair_candidates[:, start:end]
504
514
  # sub_p should not contain multiple True on the same line
505
515
  i = sub_pair_candidates.argmax(axis=1).T + np.any(
506
- sub_pair_candidates.A, axis=1
516
+ # Here we can't use the .A shorthand because it is not
517
+ # implemented in all scipy versions for coo_matrix objects
518
+ sub_pair_candidates.toarray(),
519
+ axis=1,
507
520
  )
508
521
  ids = ids + i.A * np.prod(dom[(j + 1) : dom.shape[0]])
509
522
  return ids
File without changes