{"id":17874834,"url":"https://github.com/philipphager/ultr-toolbox","last_synced_at":"2025-03-21T23:32:03.981Z","repository":{"id":156118497,"uuid":"632858009","full_name":"philipphager/ultr-toolbox","owner":"philipphager","description":"Personal toolbox for unbiased learning-to-rank written in Jax.","archived":true,"fork":false,"pushed_at":"2023-08-11T14:45:55.000Z","size":44,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-08T14:23:28.899Z","etag":null,"topics":["click-model","learning-to-rank","unbiased-lea"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philipphager.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-04-26T09:20:47.000Z","updated_at":"2023-12-10T10:14:27.000Z","dependencies_parsed_at":"2024-10-28T11:39:20.530Z","dependency_job_id":"f2750983-9349-418d-ac10-a3d28f8bd4e8","html_url":"https://github.com/philipphager/ultr-toolbox","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/philipphager%2Fultr-toolbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipphager%2Fultr-toolbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipphager%2Fultr-toolbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipphager%2Fultr-toolbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philipphager","download_url":"https://codeload.github.com/philipphager/ultr-toolbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244885232,"owners_count":20526282,"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":["click-model","learning-to-rank","unbiased-lea"],"created_at":"2024-10-28T11:12:07.315Z","updated_at":"2025-03-21T23:32:03.976Z","avatar_url":"https://github.com/philipphager.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Install\n```bash\npip install ultr-toolbox\n```\n\n## Click Models\n\n### Create Datasets\n```Python\nfrom ultr_toolbox.click_models.data import ClickDataset\n\ntrain_dataset = ClickDataset(train_df)\nval_dataset = ClickDataset(val_df)\ntest_dataset = ClickDataset(test_df)\n```\n\n### Train neural click models\n```\nfrom ultr_toolbox.click_models.metrics import Perplexity\nfrom ultr_toolbox.click_models.neural import PositionBasedModel, NeuralTrainer\n\nmodel = PositionBasedModel()\ntrainer = NeuralTrainer(model)\ntrainer.fit(train_dataset, val_dataset)\nmetrics = trainer.test(test_dataset, metrics=[Perplexity()])\n```\n\n### Train PyClick models\nTo optionally train click models from the [PyClick](https://github.com/markovi/PyClick) library,\nfirst install PyClick as a dependency:\n```bash\npip install git+https://github.com/markovi/PyClick\n```\n\nNext, you can use the `PyClickTrainer` module to run the same pipeline as for the Jax-based neural click models:\n```\nfrom pyclick.click_models import PBM\n\nfrom ultr_toolbox.click_models.metrics import Perplexity\nfrom ultr_toolbox.click_models.em import PyClickTrainer\n\nmodel = PBM()\ntrainer = PyClickTrainer(model)\ntrainer.fit(train_dataset, val_dataset)\nmetrics = trainer.test(test_dataset, metrics=[Perplexity()])\n```\n\n### Train naive models based on click statistics\n```\nfrom ultr_toolbox.click_models.metrics import Perplexity\nfrom ultr_toolbox.click_models.stats import StatsTrainer, RankDocumentBasedModel\n\nmodel = RankDocumentBasedModel()\ntrainer = StatsTrainer(model)\ntrainer.fit(train_dataset, val_dataset)\nmetrics = trainer.test(test_dataset, metrics=[Perplexity()])\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipphager%2Fultr-toolbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilipphager%2Fultr-toolbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipphager%2Fultr-toolbox/lists"}