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

Make the utils.isnan function inline #624

Merged
merged 1 commit into from
Oct 1, 2019

Conversation

alexhenrie
Copy link
Contributor

Bayes net training is about 35% faster when isnan is inlined, which makes sense because npy_isnan was designed to be an inline function.

Test program:

import numpy as np
from neurtu import delayed, Benchmark
from pomegranate import BayesianNetwork
from random import random

X = np.round(np.random.rand(10000, 16))
train = delayed(BayesianNetwork)().from_samples(X)

print(Benchmark(wall_time=True, cpu_time=True, repeat=3)(train))

Non-inline isnan:

      wall_time  cpu_time                                                                                                     
mean   8.369287  8.361042
max    8.488417  8.471947
std    0.103549  0.112760

Inline isnan:

      wall_time  cpu_time                                                                                                     
mean   5.361331  5.360565
max    5.379823  5.376542
std    0.030915  0.019036

@jmschrei
Copy link
Owner

jmschrei commented Oct 1, 2019

I can reproduce this. Nice find.

@jmschrei jmschrei merged commit 2dc0f9d into jmschrei:master Oct 1, 2019
@alexhenrie
Copy link
Contributor Author

Thank you!!!

@alexhenrie alexhenrie deleted the inline_isnan branch October 2, 2019 00:44
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

Successfully merging this pull request may close these issues.

2 participants