{"id":15432784,"url":"https://github.com/gugarosa/opf_siamese","last_synced_at":"2025-06-11T05:32:57.314Z","repository":{"id":48191402,"uuid":"276700459","full_name":"gugarosa/opf_siamese","owner":"gugarosa","description":"📄 Official implementation regarding the chapter \"Learning to Weight Similarity Measures with Siamese Networks: A Case Study on Optimum-Path Forest\". ","archived":false,"fork":false,"pushed_at":"2022-10-06T12:59:35.000Z","size":3812,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-18T07:40:00.634Z","etag":null,"topics":["chapter","implementation","machine-learning","opf","siamese-network"],"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}},"created_at":"2020-07-02T16:52:58.000Z","updated_at":"2022-07-22T13:54:53.000Z","dependencies_parsed_at":"2022-08-30T16:12:45.318Z","dependency_job_id":null,"html_url":"https://github.com/gugarosa/opf_siamese","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugarosa%2Fopf_siamese","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugarosa%2Fopf_siamese/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugarosa%2Fopf_siamese/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugarosa%2Fopf_siamese/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gugarosa","download_url":"https://codeload.github.com/gugarosa/opf_siamese/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gugarosa%2Fopf_siamese/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259207701,"owners_count":22821744,"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":["chapter","implementation","machine-learning","opf","siamese-network"],"created_at":"2024-10-01T18:28:35.674Z","updated_at":"2025-06-11T05:32:57.286Z","avatar_url":"https://github.com/gugarosa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning to Weight Similarity Measures with Siamese Networks: A Case Study on Optimum-Path Forest\n\n*This repository holds all the necessary code to run the very-same experiments described in the chapter \"Learning to Weight Similarity Measures with Siamese Networks: A Case Study on Optimum-Path Forest\".*\n\n---\n\n## References\n\nIf you use our work to fulfill any of your needs, please cite us:\n\n```BibTex\n@incollection{deRosa:22,\n  title = {Chapter 7 - Learning to weight similarity measures with Siamese networks: a case study on optimum-path forest☆☆The authors appreciate São Paulo Research Foundation (FAPESP) grants #2013/07375-0, #2014/12236-1, #2017/25908-6, #2018/15597-6, #2018/21934-5 and #2019/02205-5, and CNPq grants 307066/2017-7 and 427968/2018-6.},\n  editor = {Alexandre Xavier Falcão and João Paulo Papa},\n  booktitle = {Optimum-Path Forest},\n  publisher = {Academic Press},\n  pages = {155-173},\n  year = {2022},\n  isbn = {978-0-12-822688-9},\n  doi = {https://doi.org/10.1016/B978-0-12-822688-9.00015-3},\n  url = {https://www.sciencedirect.com/science/article/pii/B9780128226889000153},\n  author = {Gustavo H. {de Rosa} and João Paulo Papa}\n}\n```\n\n---\n\n## Structure\n\n * `data`: Folder containing the OPF file format datasets;\n * `outputs`: Folder for saving the output files, such as `.npy`, `.pkl` and `.txt`;\n * `utils`\n   * `loader.py`: Loads OPF file format datasets;\n   * `similarity.py`: Calculates the similarity between pairs of samples.\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\nPlease [download](https://www.recogna.tech/files/opf_siamese/data.tar.gz) the datasets in the OPF file format and put then on the `data/` folder.\n\n---\n\n## Usage\n\n### Learn a Similarity Function\n\nThe first step is to learn a similarity function based on the training data and create the dataset's squared similarity matrix. To accomplish such a step, one needs to use the following script:\n\n```Python\npython learn_similarities.py -h\n```\n\n*Note that `-h` invokes the script helper, which assists users in employing the appropriate parameters.*\n\n### Perform the Classification\n\nAfter learning the similarity, one needs to classify the data using an OPF-based classifier or Scikit-Learn classifiers. Please, use the following scripts to accomplish such a procedure:\n\n```Python\npython classify_with_opf.py -h\n```\n\nor\n\n```Python\npython classify_without_opf.py -h\n```\n\n### Process Classification Reports\n\nAfter conducting the classification task, one needs to process its report into readable outputs. Please, use the following script to accomplish such a procedure:\n\n```Python\npython process_report.py -h\n```\n\n*Note that this script converts the .pkl reports into readable .txt outputs.*\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 chapter. 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgugarosa%2Fopf_siamese","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgugarosa%2Fopf_siamese","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgugarosa%2Fopf_siamese/lists"}