dedupe icon indicating copy to clipboard operation
dedupe copied to clipboard

OverflowError: Python int too large to convert to C long for Record Link prepare_training

Open gibranhasan14 opened this issue 6 years ago • 1 comments

Hi,

I'm using a Jupyter Notebook on Windows 10. Similar to #677 I've tried changing dtype in random_pairs but nothing seems to work. The length of my datasets are 120k rows, works fine with smaller datasets (where the sample size is larger than the record pair combinations). The sample size is set to 50000.

sys.maxsize

9223372036854775807

 ---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)
<ipython-input-187-d62239ac8301> in <module>
     52 
     53     else:
---> 54         linker.prepare_training(data_1, data_2, sample_size= 150000)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\dedupe\api.py in prepare_training(self, data_1, data_2, training_file, sample_size, blocked_proportion, original_length_1, original_length_2)
   1353                      blocked_proportion,
   1354                      original_length_1,
-> 1355                      original_length_2)
   1356 
   1357     def _sample(self,

~\AppData\Local\Continuum\anaconda3\lib\site-packages\dedupe\api.py in _sample(self, data_1, data_2, sample_size, blocked_proportion, original_length_1, original_length_2)
   1387                                                  original_length_1,
   1388                                                  original_length_2,
-> 1389                                                  index_include=examples)
   1390 
   1391         self.active_learner.mark(examples, y)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\dedupe\labeler.py in __init__(self, data_model, data_1, data_2, blocked_proportion, sample_size, original_length_1, original_length_2, index_include)
    446                                          data_2,
    447                                          blocked_proportion,
--> 448                                          sample_size)
    449 
    450         random_pair = random.choice(self.candidates)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\dedupe\labeler.py in sample(self, data_1, data_2, blocked_proportion, sample_size)
     75         random_sample_keys = core.randomPairsMatch(len(deque_1),
     76                                                    len(deque_2),
---> 77                                                    random_sample_size)
     78 
     79         random_sample_keys = {(a, b + offset)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\dedupe\core.py in randomPairsMatch(n_records_A, n_records_B, sample_size)
     78 
     79     else:
---> 80 
     81         random_pairs = numpy.array(random.sample(range(n), sample_size) , dtype = int) 
     82 

OverflowError: Python int too large to convert to C long

Would appreciate any help or guidance.

gibranhasan14 avatar Jun 15 '20 10:06 gibranhasan14

I always fix this by manually removing the "dtype = int" part from the Dedupe code ..

felixpoege avatar Sep 06 '20 09:09 felixpoege