def test_checkIfOnlyBestMappingIsKept_ChoosesTheOneWithHighestGTConf(self): dfs = pd.DataFrame(data=[ create_recall_report_row("truth_probe_1", AlignmentAssessment.UNMAPPED, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_1", AlignmentAssessment.PARTIALLY_MAPPED, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_1", AlignmentAssessment.PRIMARY_INCORRECT, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_1", AlignmentAssessment.SECONDARY_INCORRECT, gt_conf=100, with_gt_conf=True), create_recall_report_row( "truth_probe_1", AlignmentAssessment.SUPPLEMENTARY_INCORRECT, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_1", AlignmentAssessment.PRIMARY_CORRECT, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_1", AlignmentAssessment.SECONDARY_CORRECT, gt_conf=200, with_gt_conf=True), create_recall_report_row("truth_probe_1", AlignmentAssessment.SUPPLEMENTARY_CORRECT, gt_conf=150, with_gt_conf=True), ], ) report = RecallReport([dfs]) actual = report.report expected = pd.DataFrame(data=[ create_recall_report_row("truth_probe_1", AlignmentAssessment.SECONDARY_CORRECT, gt_conf=200, with_gt_conf=True) ]) assert_frame_equal(actual, expected, check_dtype=False)
def test_checkIfOnlyBestMappingIsKept_hasPrimaryMapping_and_several_dfs( self): df_1 = pd.DataFrame(data=[ create_recall_report_row("truth_probe_1", AlignmentAssessment.UNMAPPED, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_1", AlignmentAssessment.PARTIALLY_MAPPED, gt_conf=100, with_gt_conf=True), ], ) df_2 = pd.DataFrame(data=[ create_recall_report_row("truth_probe_1", AlignmentAssessment.PRIMARY_INCORRECT, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_1", AlignmentAssessment.SECONDARY_INCORRECT, gt_conf=100, with_gt_conf=True), ], ) df_3 = pd.DataFrame(data=[ create_recall_report_row( "truth_probe_1", AlignmentAssessment.SUPPLEMENTARY_INCORRECT, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_1", AlignmentAssessment.PRIMARY_CORRECT, gt_conf=100, with_gt_conf=True), ], ) report = RecallReport([df_1, df_2, df_3]) actual = report.report expected = pd.DataFrame(data=[ create_recall_report_row("truth_probe_1", AlignmentAssessment.PRIMARY_CORRECT, gt_conf=100, with_gt_conf=True) ]) assert_frame_equal(actual, expected, check_dtype=False)
def test_simple_concatenation_with_several_dfs(self): df_1 = pd.DataFrame(data=[ create_recall_report_row("truth_probe_1", AlignmentAssessment.UNMAPPED, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_2", AlignmentAssessment.PARTIALLY_MAPPED, gt_conf=100, with_gt_conf=True), ], ) df_2 = pd.DataFrame(data=[ create_recall_report_row("truth_probe_3", AlignmentAssessment.PRIMARY_INCORRECT, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_4", AlignmentAssessment.SECONDARY_INCORRECT, gt_conf=100, with_gt_conf=True), ], ) df_3 = pd.DataFrame(data=[ create_recall_report_row( "truth_probe_5", AlignmentAssessment.SUPPLEMENTARY_INCORRECT, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_6", AlignmentAssessment.PRIMARY_CORRECT, gt_conf=100, with_gt_conf=True), ], ) report = RecallReport( [df_1, df_2, df_3], concatenate_dfs_one_by_one_keeping_only_best_mappings=False) actual = report.report expected = pd.DataFrame(data=[ create_recall_report_row("truth_probe_1", AlignmentAssessment.UNMAPPED, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_2", AlignmentAssessment.PARTIALLY_MAPPED, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_3", AlignmentAssessment.PRIMARY_INCORRECT, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_4", AlignmentAssessment.SECONDARY_INCORRECT, gt_conf=100, with_gt_conf=True), create_recall_report_row( "truth_probe_5", AlignmentAssessment.SUPPLEMENTARY_INCORRECT, gt_conf=100, with_gt_conf=True), create_recall_report_row("truth_probe_6", AlignmentAssessment.PRIMARY_CORRECT, gt_conf=100, with_gt_conf=True), ]) assert_frame_equal(actual, expected, check_dtype=False)