L2R Learner
Learner for Learning to Rank Applications
This module contains a specialized version of fastai’s full fledged Learner
. Every functionality here can also be achieved with fastai’s Learner
. The purpose of re-creating a learner was purely educational.
L2RLearner
L2RLearner (model, dls, grad_func, loss_func, lr, cbs, opt_func=<function SGD>, path=None, moms:tuple=(0.95, 0.08, 0.95))
Initialize self. See help(type(self)) for accurate signature.
Serializing
L2RLearner.save
L2RLearner.save (file, with_opt=True, pickle_protocol=2)
Save model and optimizer state (if ‘with_opt’) to self.path/file
L2RLearner.load
L2RLearner.load (file, device=None, with_opt=True, strict=True)
Load model and optimizer state (if with_opt
) from self.path/file
using device
L2RLearner.show_results
L2RLearner.show_results (device=None, k=None)
Produces the ranking for 100 random labels
Learner convenience functions
get_learner
get_learner (model, dls, grad_fn=<function rank_loss3>, loss_fn=<function loss_fn2>, lr=1e-05, cbs=None, opt_func=functools.partial(<function SGD at 0x7f99c2c4a1f0>, mom=0.9), lambrank=False, **kwargs)