{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/interpret-your-decision-logical-reasoning","title":"Interpret Your Decision: Logical Reasoning Regularization for Generalization in Visual Classification","arxiv_id":"2410.04492","date":"2024-10-06","proceeding":null,"authors":["Zhaorui Tan","Xi Yang","Qiufeng Wang","Anh Nguyen","Kaizhu Huang"],"abstract":"Vision models excel in image classification but struggle to generalize to unseen data, such as classifying images from unseen domains or discovering novel categories. In this paper, we explore the relationship between logical reasoning and deep learning generalization in visual classification. A logical regularization termed L-Reg is derived which bridges a logical analysis framework to image classification. Our work reveals that L-Reg reduces the complexity of the model in terms of the feature distribution and classifier weights. Specifically, we unveil the interpretability brought by L-Reg, as it enables the model to extract the salient features, such as faces to persons, for classification. Theoretical analysis and experiments demonstrate that L-Reg enhances generalization across various scenarios, including multi-domain generalization and generalized category discovery. In complex real-world scenarios where images span unknown classes and unseen domains, L-Reg consistently improves generalization, highlighting its practical efficacy.","url_abs":"https://arxiv.org/abs/2410.04492v5","url_pdf":"https://arxiv.org/pdf/2410.04492v5.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"interpret-your-decision-logical-reasoning","repo_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"classification-1","task_name":"Classification"},{"task_slug":"domain-generalization","task_name":"Domain Generalization"},{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"logical-reasoning","task_name":"Logical Reasoning"},{"task_slug":"image-classification","task_name":"image-classification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2410.04492","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.04492"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24","reach":{"status":"ok"}}],"summary":{"ran":14,"ran_draft_wrong":1,"ran_honours":1},"by_repo_kind":{"official":{"samples":16,"ran":16,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":16,"samples":[{"code_sha256_prefix":"8b95279f62a6de12","entry":"cluster_acc","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/metrics/partitioning_metrics.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/metrics/partitioning_metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8b95279f62a6de12"}},{"code_sha256_prefix":"718b40821d51b975","entry":"cluster_acc_old_only","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/metrics/partitioning_metrics.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/metrics/partitioning_metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"718b40821d51b975"}},{"code_sha256_prefix":"c5ffd1f80f4c6143","entry":"cluster_acc_v1","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/metrics/partitioning_metrics.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/metrics/partitioning_metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c5ffd1f80f4c6143"}},{"code_sha256_prefix":"51bb4fe1538019ee","entry":"eucl_KM_plspls_init","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/models/clustering_methods/torch_semi_supervised_kmeans.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/models/clustering_methods/torch_semi_supervised_kmeans.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"51bb4fe1538019ee"}},{"code_sha256_prefix":"bb13df6d81184643","entry":"from_numpy_to_torch","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/models/clustering_methods/torch_semi_supervised_kmeans.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/models/clustering_methods/torch_semi_supervised_kmeans.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bb13df6d81184643"}},{"code_sha256_prefix":"4589e8fefcf1cfd3","entry":"from_torch_to_numpy","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/models/clustering_methods/torch_semi_supervised_kmeans.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/models/clustering_methods/torch_semi_supervised_kmeans.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4589e8fefcf1cfd3"}},{"code_sha256_prefix":"f96a1966a9ed5908","entry":"get_assumed_nbr_of_classes","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/configs/config_K.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/configs/config_K.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f96a1966a9ed5908"}},{"code_sha256_prefix":"264dc878cb97f3a4","entry":"get_cond_shift","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/pim_partitioning.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/pim_partitioning.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"264dc878cb97f3a4"}},{"code_sha256_prefix":"30bf8f7e6e3f3c84","entry":"get_fm_preds_and_gt_labels","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/feature_maps_manip/feature_maps_manip.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/feature_maps_manip/feature_maps_manip.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"30bf8f7e6e3f3c84"}},{"code_sha256_prefix":"07c80893eff8faf0","entry":"get_fm_preds_and_gt_labels","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/feature_maps_manip/feature_maps_manip_sampling.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/feature_maps_manip/feature_maps_manip_sampling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"07c80893eff8faf0"}},{"code_sha256_prefix":"c5919b96db289dbd","entry":"get_shapes","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"mDG_and_mDG+GCD_with_L-Reg/domainbed/algorithms/miro.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/mDG_and_mDG%2BGCD_with_L-Reg/domainbed/algorithms/miro.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c5919b96db289dbd"}},{"code_sha256_prefix":"215591efb9e0f55c","entry":"get_valid_mask_and_filtered_seen_mask","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/feature_maps_manip/feature_maps_manip_sampling.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/feature_maps_manip/feature_maps_manip_sampling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"215591efb9e0f55c"}},{"code_sha256_prefix":"bedff51745d2cf84","entry":"l2normalize","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/pim_partitioning.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/pim_partitioning.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bedff51745d2cf84"}},{"code_sha256_prefix":"67994beae3421efd","entry":"sample_covariance","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/pim_partitioning.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/pim_partitioning.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"67994beae3421efd"}},{"code_sha256_prefix":"1eb0a4ac3b56b8ab","entry":"sample_mask_lab","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"GCD_PIM_with_L-Reg/feature_maps_manip/feature_maps_manip_sampling.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/GCD_PIM_with_L-Reg/feature_maps_manip/feature_maps_manip_sampling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1eb0a4ac3b56b8ab"}},{"code_sha256_prefix":"12c23ce22097acd0","entry":"to_minibatch","repo":"zhaorui-tan/L-Reg_NeurIPS24","repo_kind":"official","path":"mDG_and_mDG+GCD_with_L-Reg/domainbed/algorithms/algorithms.py","file_url":"https://github.com/zhaorui-tan/L-Reg_NeurIPS24/blob/HEAD/mDG_and_mDG%2BGCD_with_L-Reg/domainbed/algorithms/algorithms.py","link_basis":"plan_row","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"12c23ce22097acd0"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}