Cythonize - #5
Open
VorontsovIE wants to merge 21 commits into
Open
Conversation
VorontsovIE
force-pushed
the
cythonize
branch
2 times, most recently
from
December 27, 2018 23:20
7aa4f2f to
3c3deaa
Compare
Contributor
|
Этот надо поребейзить |
VorontsovIE
force-pushed
the
cythonize
branch
from
February 15, 2019 12:37
63e7f3e to
e9cb5b2
Compare
…not to create a numpy array but to modify existing
…tion not to recreate an array each time
…zations) in cython.
…lty for dynamic typing here (in SquareSplitter cython code) shouldn't be very big
…ey can be inlined from another module
…, mocks inherit it
VorontsovIE
force-pushed
the
cythonize
branch
from
February 15, 2019 12:59
e9cb5b2 to
02e9f87
Compare
Dronte
requested changes
Feb 16, 2019
Dronte
left a comment
Contributor
There was a problem hiding this comment.
Очень круто. Небольшие проблемы со стилем, в остальном все ок.
| if self.split_number_regularization_multiplier != 0: | ||
| number_regularization = self.split_number_regularization_function(num_splits[:prefix_end] + 1) | ||
| score_if_last_split_at[:prefix_end] -= self.split_number_regularization_multiplier * number_regularization | ||
| score_if_last_split_at[0] += self.split_number_regularization_multiplier * self.split_number_regularization_function(1) |
Contributor
There was a problem hiding this comment.
Не сделать ли тут строчки покороче?
| from Cython.Build import cythonize | ||
| from setuptools.extension import Extension | ||
|
|
||
| gcc_opts = ['-march=native', '-Ofast',] |
Contributor
There was a problem hiding this comment.
-O2 ?
-flto ?
-funroll-loops ?
| assert optimal_score == 1 | ||
|
|
||
| sequence = 'AAA' | ||
| sequence = seq2array('AAA') |
Contributor
There was a problem hiding this comment.
Вообще говоря, один из смыстов этих тестов был в том, что не важно, какую именно последовательность мы бъем, важно, как мы ее скорим.
Contributor
There was a problem hiding this comment.
Но я понимаю, что с cython этот номер не прокатит.
| raise NotImplementedError() | ||
|
|
||
| cdef class LogMarginalLikelyhoodComputer(BasicLogMarginalLikelyhoodComputer): | ||
| def __init__(self, counts, alpha, beta, split_candidates, log_computer=None, log_gamma_computer=None, log_gamma_alpha_computer=None): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimization: LogML and square splitter are now written using cython in critical places. 4x times speed boost overall.