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

Leastsampledclasssampler slow #8

Open
rfigge24 opened this issue Mar 7, 2024 · 0 comments
Open

Leastsampledclasssampler slow #8

rfigge24 opened this issue Mar 7, 2024 · 0 comments

Comments

@rfigge24
Copy link
Contributor

rfigge24 commented Mar 7, 2024

I noticed the the LeastSampledClassSampler was a bit slow, when looking at the code I saw that the sample function has

for class_, indicator in enumerate(self.labels[self.indices[chosen_index]]):
            if indicator == 1:
                self.counts[class_] += 1

in it. I suppose it would be faster if this was not a python for loop but the following:

self.counts += (self.labels[self.indices[chosen_index]] == 1).int()

I'm pretty new to github so not sure how I would have turned this into a pullrequest.

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

No branches or pull requests

1 participant