Skip to content
This repository has been archived by the owner on Dec 10, 2023. It is now read-only.
/ ultr-toolbox Public archive

Personal toolbox for unbiased learning-to-rank written in Jax.

Notifications You must be signed in to change notification settings

philipphager/ultr-toolbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install

pip install ultr-toolbox

Click Models

Create Datasets

from ultr_toolbox.click_models.data import ClickDataset

train_dataset = ClickDataset(train_df)
val_dataset = ClickDataset(val_df)
test_dataset = ClickDataset(test_df)

Train neural click models

from ultr_toolbox.click_models.metrics import Perplexity
from ultr_toolbox.click_models.neural import PositionBasedModel, NeuralTrainer

model = PositionBasedModel()
trainer = NeuralTrainer(model)
trainer.fit(train_dataset, val_dataset)
metrics = trainer.test(test_dataset, metrics=[Perplexity()])

Train PyClick models

To optionally train click models from the PyClick library, first install PyClick as a dependency:

pip install git+https://github.com/markovi/PyClick

Next, you can use the PyClickTrainer module to run the same pipeline as for the Jax-based neural click models:

from pyclick.click_models import PBM

from ultr_toolbox.click_models.metrics import Perplexity
from ultr_toolbox.click_models.em import PyClickTrainer

model = PBM()
trainer = PyClickTrainer(model)
trainer.fit(train_dataset, val_dataset)
metrics = trainer.test(test_dataset, metrics=[Perplexity()])

Train naive models based on click statistics

from ultr_toolbox.click_models.metrics import Perplexity
from ultr_toolbox.click_models.stats import StatsTrainer, RankDocumentBasedModel

model = RankDocumentBasedModel()
trainer = StatsTrainer(model)
trainer.fit(train_dataset, val_dataset)
metrics = trainer.test(test_dataset, metrics=[Perplexity()])

About

Personal toolbox for unbiased learning-to-rank written in Jax.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages