Moving linear regression indicator with numba #292
Unanswered
andreas-vester
asked this question in
Q&A
Replies: 1 comment
-
@andreas-vester sorry, don't have time to help with that, better ask on Numba forum: https://numba.discourse.group |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to create a moving linear regression indicator and I wanted to utilize
numba
. However, I am struggling with the latter part.Here's what I have so far. It is working, however, without applying
numba
it is quite slow once you throw large arrays at it.The indicator is actually computing a linear regression applying
np.linalg.lstsq
function (https://numpy.org/doc/stable/reference/generated/numpy.linalg.lstsq.html) for a givenwindow
length. It than basically outputs the very last point of the regression line and moves on to the next range and computes the linear regression again. At the end of the day,ols_1d
outputs the last point of every individual regression line putting it into an array.Now, I need help in order to apply
numba
on top of it. I am not familiar withnumba
, but as far as my own trial and error goes, there might be an issue utilizingnb.lib.stride_tricks.sliding_window_view()
.Beta Was this translation helpful? Give feedback.
All reactions