Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature req: add w parameter (ex sample_weight) to progressive_val_score #1502

Open
niccolopetti opened this issue Feb 6, 2024 · 2 comments

Comments

@niccolopetti
Copy link
Contributor

The fit method of sklearn has a sample_weight parameter to pass weights of the instances, and the learn_one method of river also has that attribute, recently renamed to w in #1457 , currently if we had a list of weights and instances to perform our training using our weights we would have to use the learn_one method manually iterating over our data,
it would be much more comfortable to be able to pass the weights with the instances as it happens with sklearn.

it would be nice to be able to do something like:

from river import datasets
from river import evaluate
from river import metrics

evaluate.progressive_val_score(
    model=model,
    dataset=datasets.Phishing(),
    metric=metrics.ROCAUC(),
    print_every=200,
    w=weights
)

where weights contain for each instance of the dataset the corresponding weight

@MaxHalford
Copy link
Member

This is a good point. I think a more elegant approach would be to allow the dataset to yield an optional weight for each instance. I can take care of implementing this, but I don't have any time right now.

@niccolopetti
Copy link
Contributor Author

This is a good point. I think a more elegant approach would be to allow the dataset to yield an optional weight for each instance. I can take care of implementing this, but I don't have any time right now.

Thanks, I'm glad we agree and I hope to see it implemented in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants