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

Reducing computing time in floss #778

Open
NimaSarajpoor opened this issue Jan 14, 2023 · 0 comments
Open

Reducing computing time in floss #778

NimaSarajpoor opened this issue Jan 14, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@NimaSarajpoor
Copy link
Collaborator

We can see the following lines in method update:

stumpy/stumpy/floss.py

Lines 560 to 565 in 59ee63a

# Ingress
if self._normalize:
M_T, Σ_T = core.compute_mean_std(self._T, self._m)
D = core.mass(self._finite_Q, self._finite_T, M_T, Σ_T)
else:
D = core.mass_absolute(self._T[-self._m :], self._T)

As shown above, we are computing the full arrays M_T and Σ_T in each call of this method. However, this might be time consuming, and a better way is to just update these arrays in each call. It seems that this part of code is similar to:

stumpy/stumpy/stumpi.py

Lines 231 to 242 in 59ee63a

if np.any(~self._T_isfinite[-self._m :]):
μ_Q = np.inf
σ_Q = np.nan
else:
μ_Q, σ_Q = core.compute_mean_std(S, self._m)
μ_Q = μ_Q[0]
σ_Q = σ_Q[0]
self._M_T[:-1] = self._M_T[1:]
self._Σ_T[:-1] = self._Σ_T[1:]
self._M_T[-1] = μ_Q
self._Σ_T[-1] = σ_Q

which is a part of method _update_egress in class stumpi. Here, we take advantage of the previously-computed M_T and Σ_T, and we just update it.

In floss, we need to create attributes M_T and Σ_T when we create an instance of this class, and then update them.

@seanlaw seanlaw added the enhancement New feature or request label Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants