🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    isp_data_pollution.py
    skipped 454 lines
    455 455   except Exception as e:
    456 456   if self.debug: print('.update() exception:\n{}'.format(e))
    457 457   
    458  - def draw_link(self):
    459  - return self.draw_links(n=1)[0]
     458 + def draw_link(self,log_sampling=True):
     459 + return self.draw_links(n=1,log_sampling=log_sampling)[0]
    460 460   
    461  - def draw_links(self,n=1):
     461 + def draw_links(self,n=1,log_sampling=False):
    462 462   urls = []
    463 463   domain_count = np.array([(dmn,len(self.domain_links[dmn])) for dmn in self.domain_links])
    464 464   p = np.array([np.float(c) for d,c in domain_count])
    465 465   count_total = p.sum()
    466  - # log-sampling [log(x+1)] to bias lower count domains
    467  - p = np.fromiter((np.log1p(x) for x in p), dtype=p.dtype)
     466 + if log_sampling: # log-sampling [log(x+1)] to bias lower count domains
     467 + p = np.fromiter((np.log1p(x) for x in p), dtype=p.dtype)
    468 468   if count_total > 0:
    469 469   p = p/p.sum()
    470 470   cnts = npr.multinomial(n, pvals=p)
    skipped 212 lines
Please wait...
Page is in error, reload to recover