@@ -296,13 +296,13 @@ void SBF::PrintFilter(int mode)
296
296
printf (" Area-related parameters:\n " );
297
297
for (int j = 1 ; j < this ->AREA_number +1 ; j++){
298
298
potential_elements = (this ->AREA_members [j]*this ->HASH_number )-this ->AREA_self_collisions [j];
299
- printf (" Area %d: %d members, %d cells out of %d potential (%d self-collisions)" ,j,this ->AREA_members [j],this ->AREA_cells [j],potential_elements,this ->AREA_self_collisions [j]);
299
+ printf (" Area %d: %d members, %.5f expected cells, % d cells out of %d potential (%d self-collisions)" ,j,this ->AREA_members [j], this -> AREA_expected_cells [j],this ->AREA_cells [j],potential_elements,this ->AREA_self_collisions [j]);
300
300
printf (" \n " );
301
301
}
302
302
303
303
printf (" \n Emersion, Fpp, Isep:\n " );
304
304
for (int j = 1 ; j < this ->AREA_number +1 ; j++){
305
- printf (" Area %d: emersion %.5f, a-priori fpp %.5f, fpp %.5f, a-priori isep %.5f" ,j,this ->GetAreaEmersion (j),this ->AREA_a_priori_fpp [j],this ->AREA_fpp [j],this ->AREA_a_priori_isep [j]);
305
+ printf (" Area %d: expected emersion %.5f, emersion %.5f, a-priori fpp %.5f, fpp %.5f, a-priori isep %.5f, expected ise %.5f, isep %.5f " ,j,this ->GetExpectedAreaEmersion (j), this -> GetAreaEmersion (j),this ->AREA_a_priori_fpp [j],this ->AREA_fpp [j],this ->AREA_a_priori_isep [j], this -> AREA_a_priori_isep [j]* this -> AREA_members [j], this -> AREA_isep [j]);
306
306
printf (" \n " );
307
307
}
308
308
printf (" \n " );
@@ -336,10 +336,10 @@ void SBF::SaveToDisk(std::string path, int mode)
336
336
myfile << " a-priori fpp" << " ;" << this ->GetFilterAPrioriFpp () << std::endl;
337
337
myfile << " fpp" << " ;" << this ->GetFilterFpp () << std::endl;
338
338
// area-related parameters:
339
- // area,members,self-collisions,cells,emersion,a-priori fpp,fpp,a-priori isep
340
- myfile << " area" << " ;" << " members" << " ;" << " self-collisions" << " ;" << " cells" << " ;" << " emersion" << " ;" << " a-priori fpp" << " ;" << " fpp" << " ;" << " a-priori isep" << std::endl;
339
+ // area,members,expected cells, self-collisions,cells,expected emersion,emersion, a-priori fpp,fpp,a-priori isep,expected ise, isep
340
+ myfile << " area" << " ;" << " members" << " ;" << " expected cells " << " ; " << " self-collisions" << " ;" << " cells" << " ;" << " expected emersion" << " ;" << " emersion " << " ; " << " a-priori fpp" << " ;" << " fpp" << " ;" << " a-priori isep " << " ; " << " expected ise " << " ; " << " isep" << std::endl;
341
341
for (int j = 1 ; j < this ->AREA_number +1 ; j++){
342
- myfile << j << " ;" << this ->AREA_members [j] << " ;" << this ->AREA_self_collisions [j] << " ;" << this ->AREA_cells [j] << " ;" << this ->GetAreaEmersion (j) << " ;" << this ->AREA_a_priori_fpp [j] << " ;" << this ->AREA_fpp [j] << " ;" << this ->AREA_a_priori_isep [j] << std::endl;
342
+ myfile << j << " ; " << this -> AREA_members [j] << " ;" << this ->AREA_expected_cells [j] << " ;" << this ->AREA_self_collisions [j] << " ;" << this ->AREA_cells [j] << " ;" << this ->GetExpectedAreaEmersion (j) << " ; " << this -> GetAreaEmersion (j) << " ;" << this ->AREA_a_priori_fpp [j] << " ;" << this ->AREA_fpp [j] << " ;" << this ->AREA_a_priori_isep [j] << " ; " << ( float ) this -> AREA_members [j] * this -> AREA_a_priori_isep [j] << " ; " << ( float ) this -> AREA_isep [j] << std::endl;
343
343
}
344
344
345
345
}
@@ -491,7 +491,7 @@ int SBF::Check(char *string, int size)
491
491
// Computes a-priori area-specific inter-set error probability (a_priori_isep)
492
492
void SBF::SetAPrioriAreaIsep ()
493
493
{
494
- double p1 ;
494
+ double p ;
495
495
int nfill;
496
496
497
497
@@ -502,16 +502,58 @@ void SBF::SetAPrioriAreaIsep()
502
502
nfill += this ->AREA_members [j];
503
503
}
504
504
505
- p1 = (double )(1 - 1 / (double )this ->cells );
506
- p1 = (double )(1 - (double )pow (p1 , this ->HASH_number *nfill));
507
- p1 = (double )pow (p1 , this ->HASH_number );
505
+ p = (double )(1 - 1 / (double )this ->cells );
506
+ p = (double )(1 - (double )pow (p , this ->HASH_number *nfill));
507
+ p = (double )pow (p , this ->HASH_number );
508
508
509
- this ->AREA_a_priori_isep [i] = (float )p1 ;
509
+ this ->AREA_a_priori_isep [i] = (float )p ;
510
510
511
511
}
512
512
}
513
513
514
514
515
+ // Computes a-posteriori area-specific inter-set error probability (isep)
516
+ void SBF::SetAreaIsep ()
517
+ {
518
+ double p;
519
+
520
+ for (int i = this ->AREA_number ; i>0 ; i--) {
521
+
522
+ p = (double )(1 - (double )this ->GetAreaEmersion (i));
523
+ p = (double )pow (p, this ->HASH_number );
524
+
525
+ this ->AREA_isep [i] = (float )p;
526
+
527
+ }
528
+ }
529
+
530
+
531
+ // Computes the expected number of cells for each area (expected_cells)
532
+ void SBF::SetExpectedAreaCells ()
533
+ {
534
+ double p1, p2;
535
+ int nfill;
536
+
537
+
538
+ for (int i = this ->AREA_number ; i>0 ; i--) {
539
+ nfill = 0 ;
540
+
541
+ for (int j = i + 1 ; j <= this ->AREA_number ; j++) {
542
+ nfill += this ->AREA_members [j];
543
+ }
544
+
545
+ p1 = (double )(1 - 1 / (double )this ->cells );
546
+ p2 = (double )pow (p1, this ->HASH_number *nfill);
547
+ p1 = (double )(1 - (double )pow (p1, this ->HASH_number *this ->AREA_members [i]));
548
+
549
+ p1 = (double )this ->cells *p1*p2;
550
+
551
+ this ->AREA_expected_cells [i] = (float )p1;
552
+
553
+ }
554
+ }
555
+
556
+
515
557
// Computes a-priori area-specific false positives probability (a_priori_fpp)
516
558
void SBF::SetAPrioriAreaFpp ()
517
559
{
@@ -617,6 +659,24 @@ float SBF::GetFilterFpp()
617
659
return (float )p;
618
660
}
619
661
662
+
663
+ // Returns the expected emersion value for the input area
664
+ float SBF::GetExpectedAreaEmersion (int area)
665
+ {
666
+ double p;
667
+ int nfill = 0 ;
668
+
669
+ for (int j = area + 1 ; j <= this ->AREA_number ; j++) {
670
+ nfill += this ->AREA_members [j];
671
+ }
672
+
673
+ p = (double )(1 - 1 / (double )this ->cells );
674
+ p = (double )pow (p, this ->HASH_number *nfill);
675
+
676
+ return (float )p;
677
+ }
678
+
679
+
620
680
// Returns the emersion value for the input area
621
681
float SBF::GetAreaEmersion (int area)
622
682
{
0 commit comments