Repository: dirty-cat/dirty_cat (python)

Issue:
AttributeError: 'SimilarityEncoder' object has no attribute '_compute_drop_idx'
<!--Provide a brief description of the bug.-->
Our tests fail. For instance: https://github.com/dirty-cat/dirty_cat/actions/runs/4429118982/jobs/7769148318?pr=530

This is due to the fact that the `_compute_drop_idx` was renamed to `_set_drop_idx` in scikit-learn 1.2.0. 
See https://github.com/scikit-learn/scikit-learn/commit/d8a3089d3732bb0fac159f0133894babe2168ec8


Pull request description:
FIX _compute_drop_idx AttributeError with scikit-learn>=1.2.0
Fix #531

Patch:
diff --git a/dirty_cat/_fuzzy_join.py b/dirty_cat/_fuzzy_join.py
index 8b37446..1d1a43d 100644
--- a/dirty_cat/_fuzzy_join.py
+++ b/dirty_cat/_fuzzy_join.py
@@ -187,9 +187,12 @@ def fuzzy_join(
             f"how should be either 'left' or 'right', got {how!r}",
         )
 
+    if not isinstance(match_score, (int, float)):
+        raise TypeError("match_score has invalid type, expected integer or float")
+
     for param in [on, left_on, right_on]:
         if param is not None and not isinstance(param, str):
-            raise KeyError(
+            raise TypeError(
                 "Parameter 'left_on', 'right_on' or 'on' has invalid type, expected"
                 " string"
             )
diff --git a/dirty_cat/_similarity_encoder.py b/dirty_cat/_similarity_encoder.py
index 09e0ad6..d2067e6 100644
--- a/dirty_cat/_similarity_encoder.py
+++ b/dirty_cat/_similarity_encoder.py
@@ -519,9 +519,12 @@ class SimilarityEncoder(OneHotEncoder):
                 ]
             )
 
-        self.drop_idx_ = self._compute_drop_idx()
         if parse_version(sklearn.__version__) >= parse_version("1.1.0"):
             self._infrequent_enabled = False
+        if parse_version(sklearn.__version__) >= parse_version("1.2.0"):
+            self.drop_idx_ = self._set_drop_idx()
+        else:
+            self.drop_idx_ = self._compute_drop_idx()
 
         return self
 


Test patch:
diff --git a/dirty_cat/tests/test_fuzzy_join.py b/dirty_cat/tests/test_fuzzy_join.py
index 4401254..bf60a7c 100644
--- a/dirty_cat/tests/test_fuzzy_join.py
+++ b/dirty_cat/tests/test_fuzzy_join.py
@@ -100,10 +100,15 @@ def test_parameters_error(analyzer, on, how):
     ):
         fuzzy_join(df1, df2, on="a", analyzer=analyzer, how=how)
     with pytest.raises(
-        KeyError,
+        TypeError,
         match=r"invalid type",
     ):
         fuzzy_join(df1, df2, on=on, how=how)
+    with pytest.raises(
+        TypeError,
+        match=r"invalid type",
+    ):
+        fuzzy_join(df1, df2, on="a", match_score="blabla")
 
 
 def test_missing_keys():