Skip to content

how to call custom reward_fn #23

@dvespasiani

Description

@dvespasiani

Hi,
How can I parse any other (custom) reward function other than the default auc/aupr?

I am following this example on colab how to use AMBER. Say i want to implement the spearman correlation as the reward function. From the AMBER reward submodule documentation I'd took these few lines of code

from amber.architect.reward import LossAucReard
import scipy.stats as ss
reward_fn = LossAucReward(method=lambda y_true, y_score: ss.spearmanr(y_true, y_score).correlation)

and substituted 'reward_fn': {'method': 'auc'} with 'reward_fn': {'method': reward_fn(model,val_data)} but this doesnt seem to be the right way of doing it. Do you have any suggestions?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions