dedupe icon indicating copy to clipboard operation
dedupe copied to clipboard

console_training crashes if you match all records manually

Open deprekate opened this issue 5 years ago • 3 comments

The console training crashes if you totally complete the active learning. There should be a more graceful exit if you manage to manually match all records.

$ head -n 4 csv_example_messy_input.csv > temp ; mv temp csv_example_messy_input.csv 

$ python3 csv_example.py 
importing data ...
starting active labeling...
Site name : salvation army - temple / salvation army

Site name : national louis university - dr. effie o. ellis training center

0/10 positive, 0/10 negative
Do these records refer to the same thing?
(y)es / (n)o / (u)nsure / (f)inished
n
Site name : salvation army - temple / salvation army

Site name : national louis university - dr. effie o. ellis training center

0/10 positive, 1/10 negative
Do these records refer to the same thing?
(y)es / (n)o / (u)nsure / (f)inished / (p)revious
n
Site name : salvation army - temple / salvation army

Site name : salvation army - temple / salvation army

0/10 positive, 2/10 negative
Do these records refer to the same thing?
(y)es / (n)o / (u)nsure / (f)inished / (p)revious
y
Traceback (most recent call last):
  File "csv_example.py", line 127, in <module>
    dedupe.console_label(deduper)
  File "/home3/katelyn/.local/lib/python3.6/site-packages/dedupe/convenience.py", line 43, in console_label
    uncertain_pairs = deduper.uncertain_pairs()
  File "/home3/katelyn/.local/lib/python3.6/site-packages/dedupe/api.py", line 1122, in uncertain_pairs
    assert self.active_learner, "Please initialize with the sample method"
AssertionError: Please initialize with the sample method

Additionally is there a way to have dedupe treat identical records as identical? (or is it a requirement to dereplicate data before deduping?)

  • It seems extraneous to have it ask is two identical records (like site:salvation army == site:salvation army) are the same.
  • Or to have it repeatedly ask if two pairs are the same over and over again (like site:salvation army == site:national louis ; site:salvation army == site:national louis ; site:salvation army == site:national louis)

deprekate avatar Apr 07 '21 04:04 deprekate

A downside of dereplicating identical records out; is that canonicalize() is not able to use the number of replicates, in order to choose the most occurring pattern as the canonical rep

deprekate avatar Apr 07 '21 19:04 deprekate

I get the same issue when I use uncertain_pairs and go through all of them (which is what console labeller does). I found 2 workarounds for my related issue.

I've reinitialized the training by calling this again:

self.__linker.prepare_training(data_left_training, data_right_training)

Luckily it saves the pairs you've trained already, so there's no need to relabel.

And I've had it working by changing my sample size to be smaller than my data set. Main issue here is I get way less uncertain pairs setting the sample_size to something like max(len(data_left), len(data_right)), so i'm not sure how sample_size is used and it's relation to uncertain_pairs.

yi-varicent avatar Apr 07 '21 20:04 yi-varicent

i couldn't reproduce this bug report

fgregg avatar Jan 19 '22 15:01 fgregg