{"id":15432743,"url":"https://github.com/gugarosa/loss_programming","last_synced_at":"2025-07-19T08:33:58.562Z","repository":{"id":98632145,"uuid":"277539534","full_name":"gugarosa/loss_programming","owner":"gugarosa","description":"📄 Official implementation regarding the paper \"Programmatically Evolving Losses in Machine Learning\".","archived":false,"fork":false,"pushed_at":"2022-10-05T12:16:52.000Z","size":103,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-18T07:39:49.124Z","etag":null,"topics":["genetic-programming","implementation","loss-function","machine-learning","paper"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gugarosa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-06T12:45:36.000Z","updated_at":"2023-11-21T10:40:40.000Z","dependencies_parsed_at":"2023-03-07T14:45:32.039Z","dependency_job_id":null,"html_url":"https://github.com/gugarosa/loss_programming","commit_stats":{"total_commits":28,"total_committers":1,"mean_commits":28.0,"dds":0.0,"last_synced_commit":"7883abe7d1592f4e1a70f6b763aab9cfb9cc7fc3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gugarosa/loss_programming","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugarosa%2Floss_programming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugarosa%2Floss_programming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugarosa%2Floss_programming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugarosa%2Floss_programming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gugarosa","download_url":"https://codeload.github.com/gugarosa/loss_programming/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugarosa%2Floss_programming/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265905116,"owners_count":23846696,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["genetic-programming","implementation","loss-function","machine-learning","paper"],"created_at":"2024-10-01T18:28:28.214Z","updated_at":"2025-07-19T08:33:58.536Z","avatar_url":"https://github.com/gugarosa.png","language":"Python","readme":"# Programmatically Evolving Losses in Machine Learning\n\n*This repository holds all the necessary code to run the very-same experiments described in the paper \"Programmatically Evolving Losses in Machine Learning\".*\n\n---\n\n## References\n\nIf you use our work to fulfill any of your needs, please cite us:\n\n```\n```\n\n---\n\n## Structure\n\n \n * `core`\n   * `linker`\n     * `gp.py`: Provides a customized Genetic Programming implementation that can use loss functions as terminals;\n     * `node.py`: Provides a customized node structure that can use loss functions as terminals;\n     * `space.py`: Provides a customized tree space that can use loss functions as terminals;\n   * `losses.py`: Defines the losses functions that Genetic Programming can uses;\n   * `model.py`: Defines the base Machine Learning architecture;\n * `models`\n   * `cnn.py`: Defines a ResNet18 architecture;\n   * `mlp.py`: Defines the Multi-Layer Perceptron;\n * `outputs`: Folder that holds the output files, such as `.pkl` and `.txt`;\n * `utils`\n   * `loader.py`: Utility to load datasets and split them into training, validation and testing sets;\n   * `object.py`: Wraps objects for usage in command line;\n   * `target.py`: Implements the objective functions to be optimized;\n   * `wrapper.py`: Wraps the optimization task into a single method.\n   \n---\n\n## Package Guidelines\n\n### Installation\n\nInstall all the pre-needed requirements using:\n\n```Python\npip install -r requirements.txt\n```\n\n### Data configuration\n\nIf you wish to download the medical-based datasets, please contact us. Otherwise, you can use `torchvision` to load pre-implemented datasets.\n\n---\n\n## Usage\n\n### Loss Function Optimization\n\nThe first step is to optimize a loss function using Genetic Programming guided by the validation set accuracy. To accomplish such a step, one needs to use the following script:\n\n```Python\npython model_optimization.py -h\n```\n\n*Note that `-h` invokes the script helper, which assists users in employing the appropriate parameters.*\n\n### Evaluate the Optimized Loss Function\n\nAfter conducting the optimization task, one needs to evaluate the created loss function using training and testing sets. Please, use the following script to accomplish such a procedure:\n\n```Python\npython model_evaluation.py -h\n```\n\n### Bash Script\n\nInstead of invoking every script to conduct the experiments, it is also possible to use the provided shell script, as follows:\n\n```Bash\n./pipeline.sh\n```\n\nSuch a script will conduct every step needed to accomplish the experimentation used throughout this paper. Furthermore, one can change any input argument that is defined in the script.\n\n---\n\n## Support\n\nWe know that we do our best, but it is inevitable to acknowledge that we make mistakes. If you ever need to report a bug, report a problem, talk to us, please do so! We will be available at our bests at this repository.\n\n---\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgugarosa%2Floss_programming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgugarosa%2Floss_programming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgugarosa%2Floss_programming/lists"}