aeon icon indicating copy to clipboard operation
aeon copied to clipboard

[MNT] Use Numpy Vectorization in ContinuosIntervalTree fit method

Open aadya940 opened this issue 1 year ago • 2 comments

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

aadya940 avatar Mar 26 '24 14:03 aadya940

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

LinGinQiu avatar Oct 03 '24 15:10 LinGinQiu

@aeon-actions-bot assign @LinGinQiu

LinGinQiu avatar Oct 03 '24 15:10 LinGinQiu