Closed saltwater-tensor closed 1 month ago
Another point/ clarification:
Why is the following check performed:
https://github.com/OHBA-analysis/osl-dynamics/blob/main/osl_dynamics/models/hmm.py#L1557-L1558
# Make sure the data and alpha have the same number of samples
data = [d[: a.shape[0]] for d, a in zip(data, alpha)]
Shouldn't alpha and prepared data always have the same number of samples since alpha is getting estimated using the properly prepared data?
Or is there some particular step during alpha estimation that trims the estimated alpha?
Thanks.
Similarly, we encounter errors in the following function: https://github.com/OHBA-analysis/osl-dynamics/blob/main/osl_dynamics/models/hmm.py#L1564
def _single_dual_estimation(a, x)
Here in the following lines: https://github.com/OHBA-analysis/osl-dynamics/blob/main/osl_dynamics/models/hmm.py#L1578-L1586
Since the data supplied is for a single session a and x both would be two dimensional. Therefore, diff produces an error.
diff = x - session_means[state]
session_covariances[state] = (
np.sum(
diff[:, :, None]
* diff[:, None, :]
* a[:, state, None, None],
axis=0,
)
/ sum_a[state]
Why is the following check performed:
https://github.com/OHBA-analysis/osl-dynamics/blob/main/osl_dynamics/models/hmm.py#L1557-L1558
Just an extra check, might not be needed but kept to be safe.
For the following lines of code:
https://github.com/OHBA-analysis/osl-dynamics/blob/main/osl_dynamics/models/hmm.py#L1541-L1556
If we supply the training data as osl_dynamics.data.Data object that contains a single time series. Then the code will always lead to an error because the following line will be run: https://github.com/OHBA-analysis/osl-dynamics/blob/main/osl_dynamics/models/hmm.py#L1550
And subsequently, when the following lines are run
len(data)
will result in the number of samples in the time series rather than the number of sessions or subjects, causing errors. Although that should not be the case.