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

[MNT] Use Numpy Vectorization in ContinuosIntervalTree fit method #1345

Closed
aadya940 opened this issue Mar 26, 2024 · 2 comments
Closed

[MNT] Use Numpy Vectorization in ContinuosIntervalTree fit method #1345

aadya940 opened this issue Mar 26, 2024 · 2 comments
Assignees
Labels
classification Classification package enhancement New feature, improvement request or other non-bug code enhancement

Comments

@aadya940
Copy link
Contributor

aadya940 commented Mar 26, 2024

Describe the issue

In ContinuosIntervalTree.fit method in classification/sklearn module, we use the following lines:

distribution = np.zeros(self.n_classes_)
for i in range(len(y)):
    distribution[y[i]] += 1

Instead we could replace it by the following code and benefit from some numpy vectorization:

_, distribution = np.unique(y, return_counts=True)

Suggest a potential alternative/fix

No response

Additional context

No response

@MatthewMiddlehurst MatthewMiddlehurst added enhancement New feature, improvement request or other non-bug code enhancement classification Classification package labels Apr 12, 2024
@TonyBagnall TonyBagnall added the good first issue Good for newcomers label Jun 8, 2024
@LinGinQiu
Copy link
Contributor

Maybe it will be my first issue. I will try.

@LinGinQiu
Copy link
Contributor

@aeon-actions-bot assign @LinGinQiu

@aeon-actions-bot aeon-actions-bot bot removed the good first issue Good for newcomers label Oct 3, 2024
LinGinQiu pushed a commit to LinGinQiu/aeon that referenced this issue Oct 3, 2024
TonyBagnall pushed a commit that referenced this issue Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
classification Classification package enhancement New feature, improvement request or other non-bug code enhancement
Projects
None yet
Development

No branches or pull requests

4 participants