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
ENH - More efficient B.dot
and B.T.dot
in Cox datafit
#168
ENH - More efficient B.dot
and B.T.dot
in Cox datafit
#168
Conversation
Need to merge #167 beforehand |
The test fails because the gradient and Hessian disagree with However, I pushed a @mathurinm, any clues? |
…into cox-df-enhanced
@@ -654,38 +658,53 @@ def initialize(self, X, y): | |||
"""Initialize the datafit attributes.""" | |||
tm, s = y | |||
|
|||
tm_as_col = tm.reshape((-1, 1)) | |||
self.B = (tm >= tm_as_col).astype(X.dtype) | |||
self.T_indices = np.argsort(tm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
In Cox datafit, It is possible to perform the operations evolving the matrix
B
in linear time and without having to form explicitly the matrix.Up to a sorting permutation of
tm
, the matrix B has a block triangular structure involving matrices with coordinates equal to 1.Hence applying
B
to a vector (slightly) resembles performing a cumulative sum on the coordinates ofv
.Advantage
B
Benchmarks
A link to benchmark results to showcase the timing improvements compared to the
main
branch.Riding "la trottinette 🛴 à la @agramfort"