If we try to use Linker.evaluation.accuracy_analysis_from_labels_table after profile_columns we get an error along the lines of
Error was: Catalog Error: Table with name __splink__df_tf_city_bc4407cb3 does not exist!
Did you mean "__splink__input_table_0"?
LINE 22: left join __splink__df_tf_city_bc4407cb3 on __splink__df_concat."city...
It appears to be something to do with stale cache - in profile_columns we delete tables but do not invalidate cache. It is straightforward to fix by invalidating cache right after we delete tables.
Probably better is to delete relevant cache entries as we delete tables.
Reprex below. Interestingly if we remove the EM training step it also runs fine, for reasons I haven't looked into.
import splink.comparison_library as cl
from splink import DuckDBAPI, Linker, SettingsCreator, block_on, splink_datasets
from splink.exploratory import profile_columns
from splink.internals.datasets import splink_dataset_labels
df = splink_datasets.fake_1000
settings = SettingsCreator(
link_type="dedupe_only",
comparisons=[
cl.JaroWinklerAtThresholds("first_name", [0.9, 0.7]).configure(
term_frequency_adjustments=True
),
cl.JaroAtThresholds("surname", [0.9, 0.7]),
cl.DateOfBirthComparison(
"dob",
input_is_string=False,
),
cl.ExactMatch("city").configure(term_frequency_adjustments=True),
],
blocking_rules_to_generate_predictions=[
block_on("first_name"),
block_on("surname"),
],
)
db_api = DuckDBAPI()
sdf = db_api.register(df)
linker = Linker(sdf, settings)
linker.training.estimate_parameters_using_expectation_maximisation(
block_on("first_name")
)
profile_columns(sdf, ["surname"])
df_labels = splink_dataset_labels.fake_1000_labels
sdf_labels = db_api.register(df_labels)
linker.evaluation.accuracy_analysis_from_labels_table(sdf_labels)
If we try to use
Linker.evaluation.accuracy_analysis_from_labels_tableafterprofile_columnswe get an error along the lines ofIt appears to be something to do with stale cache - in
profile_columnswe delete tables but do not invalidate cache. It is straightforward to fix by invalidating cache right after we delete tables.Probably better is to delete relevant cache entries as we delete tables.
Reprex below. Interestingly if we remove the EM training step it also runs fine, for reasons I haven't looked into.