{"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/a-unified-approach-to-count-based-weakly","title":"A Unified Approach to Count-Based Weakly-Supervised Learning","arxiv_id":"2311.13718","date":"2023-11-22","proceeding":null,"authors":["Vinay Shukla","Zhe Zeng","Kareem Ahmed","Guy Van Den Broeck"],"abstract":"High-quality labels are often very scarce, whereas unlabeled data with inferred weak labels occurs more naturally. In many cases, these weak labels dictate the frequency of each respective class over a set of instances. In this paper, we develop a unified approach to learning from such weakly-labeled data, which we call count-based weakly-supervised learning. At the heart of our approach is the ability to compute the probability of exactly k out of n outputs being set to true. This computation is differentiable, exact, and efficient. Building upon the previous computation, we derive a count loss penalizing the model for deviations in its distribution from an arithmetic constraint defined over label counts. We evaluate our approach on three common weakly-supervised learning paradigms and observe that our proposed approach achieves state-of-the-art or highly competitive results across all three of the paradigms.","url_abs":"https://arxiv.org/abs/2311.13718v1","url_pdf":"https://arxiv.org/pdf/2311.13718v1.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":"a-unified-approach-to-count-based-weakly","repo_url":"https://github.com/ucla-starai/countloss","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"weakly-supervised-learning","task_name":"Weakly-supervised Learning"}],"methods":[{"method_slug":"set","method_name":"SET"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2311.13718","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2311.13718"}},"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/ucla-starai/countloss","reach":{"status":"ok"}}],"summary":{"ran":11,"ran_honours":1,"ran_draft_wrong":3,"unverified":4},"by_repo_kind":{"official":{"samples":19,"ran":15,"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":19,"samples":[{"code_sha256_prefix":"e4361b7969382ced","entry":"DKW_bound","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/estimator.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/estimator.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":"e4361b7969382ced"}},{"code_sha256_prefix":"8300cfc19767c0d2","entry":"ResNet18_1_classes","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/models/ResNet1.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/models/ResNet1.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":"8300cfc19767c0d2"}},{"code_sha256_prefix":"5bd3b170c7f6af0e","entry":"get_PNDataSplits","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/helper.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/helper.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":"5bd3b170c7f6af0e"}},{"code_sha256_prefix":"fb4f5de306a09bc1","entry":"get_PUDataSplits","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/helper.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/helper.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":"fb4f5de306a09bc1"}},{"code_sha256_prefix":"fa12928489b0b771","entry":"log1mexp","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/count_loss_funcs/loss_func.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/count_loss_funcs/loss_func.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":"fa12928489b0b771"}},{"code_sha256_prefix":"2af39900e3e66247","entry":"logsigmoid","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/model_helper.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/model_helper.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":"2af39900e3e66247"}},{"code_sha256_prefix":"11ef0b093d0a2f32","entry":"p_loss_func","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/count_loss_funcs/dp_loss_funcs.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/count_loss_funcs/dp_loss_funcs.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":"11ef0b093d0a2f32"}},{"code_sha256_prefix":"36e4b190d1f22912","entry":"p_probs","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/estimator.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/estimator.py","link_basis":"plan_row","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"36e4b190d1f22912"}},{"code_sha256_prefix":"0bbea9323276c2c9","entry":"prob_x_equals_k_final","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/count_loss_funcs/loss_func.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/count_loss_funcs/loss_func.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":"0bbea9323276c2c9"}},{"code_sha256_prefix":"15e592da8db46172","entry":"prob_x_equals_k_final_not_logspace","repo":"ucla-starai/countloss","repo_kind":"official","path":"LLP/utils/log_space_algo.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/LLP/utils/log_space_algo.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":"15e592da8db46172"}},{"code_sha256_prefix":"6be2aa1992b29077","entry":"ramp_loss","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/algorithm.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/algorithm.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6be2aa1992b29077"}},{"code_sha256_prefix":"de3ba3f10963a128","entry":"ret_entire_tensor_k","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/count_loss_funcs/loss_func.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/count_loss_funcs/loss_func.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":"de3ba3f10963a128"}},{"code_sha256_prefix":"f79eaa8260cc169c","entry":"sigmoid_loss","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/algorithm.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/algorithm.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f79eaa8260cc169c"}},{"code_sha256_prefix":"7fa6f48935ee1ab6","entry":"train_penultimate","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/model_helper.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/model_helper.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":"7fa6f48935ee1ab6"}},{"code_sha256_prefix":"6c57210f621bfbdb","entry":"u_probs","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/estimator.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/estimator.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6c57210f621bfbdb"}},{"code_sha256_prefix":"da1592b4d04a4a80","entry":"get_dataset","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/helper.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/helper.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"da1592b4d04a4a80"}},{"code_sha256_prefix":"b24bb0be9085efab","entry":"initialize_bert_based_model","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/models/bert.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/models/bert.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b24bb0be9085efab"}},{"code_sha256_prefix":"a723532c66558c69","entry":"u_loss_dist","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/count_loss_funcs/dp_loss_funcs.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/count_loss_funcs/dp_loss_funcs.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a723532c66558c69"}},{"code_sha256_prefix":"fb6a073eaeb902c6","entry":"u_loss_func","repo":"ucla-starai/countloss","repo_kind":"official","path":"PU/count_loss_funcs/dp_loss_funcs.py","file_url":"https://github.com/ucla-starai/countloss/blob/HEAD/PU/count_loss_funcs/dp_loss_funcs.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fb6a073eaeb902c6"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}