Skip to content

Numba Kernel #1

@AxelGiottonini

Description

@AxelGiottonini

Hello!

First of all, thanks for this tool!

I noticed that using the current library was very slow on large datasets and therefore I implemented a version of the base Kernel using Numba here.

I compared the NbKernel against the base Kernel

%%timeit

kernel = NbKernel(
    kernel="rbf",
    sigma=3,
    degree=2,
    coef0=1,
    normalize=True
)

X = np.random.randn(10000, 20)
Y = np.random.randn(10000, 20)

kernel.matrix(X, Y)

8.74 s ± 371 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
%%time

kernel = Kernel(
    kernel="rbf",
    sigma=3,
    degree=2,
    coef0=1,
    normalize=True
)

X = np.random.randn(10000, 20)
Y = np.random.randn(10000, 20)

kernel.matrix(X, Y)

CPU times: user 6min 48s, sys: 1.46 s, total: 6min 50s
Wall time: 6min 52s

Are you interested in maintaining the library and optimizing it? If that's the case and my implementaiton fits your idea, I'm happy to cooperate!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions