Update docstrings and variable names for pairwise estimator
@@ -66,8 +66,9 @@ from .cluster_studio import render_splink_cluster_studio_html
from .comparison_level import ComparisonLevel
from .comparison import Comparison
-from .match_key_analysis import mtch_key_anlysis
-
+from .match_key_analysis import (
+ count_pairwise_comparisons_by_prediction_blocking_rules_sql,
+)
logger = logging.getLogger(__name__)
@@ -1603,10 +1604,30 @@ class Linker:
res = self._execute_sql_pipeline().as_record_dict()[0]
return res["count_of_pairwise_comparisons_generated"]
- def count_pairwise_comparisons_generated_by_prediction_blocking_rules(
- self, df_predict
- ):
- sql = mtch_key_anlysis(df_predict)
+ def count_pairwise_comparisons_by_prediction_blocking_rules(self, df_predict):
+ sql = count_pairwise_comparisons_by_prediction_blocking_rules_sql(df_predict)
+ """Counts the number of edges and expected number of edges for each
+ match key (0, 1)
+
+ Args:
+ df_predict (SplinkDataFrame): SplinkDataFrame with match weights
+ and probabilities of rows matching
+
+ Examples:
+ >>> linker = DuckDBLinker(df, connection=":memory:")
+ >>> linker.load_settings_from_json("saved_settings.json")
+ >>> df_predict = linker.predict(threshold_match_probability=0.95)
+ >>> count_pairwise =
+ linker.count_pairwise_comparisons_generated_by_prediction_blocking_rules(
+ df_predict)
+ >>> count_pairwise.as_pandas_dataframe(limit=5)
+
+ Returns:
+ DataFrame: A SplinkDataFrame of the pairwise comparisons and
+ estimated pairwise comparisons generated by the blocking rules.
+
+
+ """
match_key_analysis = self._enqueue_and_execute_sql_pipeline(
sql, "match_key_analysis"
)
