You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Select channels based on covariance information."""
def __init__(self, n_chan, cov_est):
self._chs_idx = None
self.n_chan = n_chan
self.cov_est = cov_est
def fit(self, X, _y=None):
# Get the covariances of the channels for each epoch.
covs = Covariances(estimator=self.cov_est).fit_transform(X)
# Get the average covariance between the channels
m = np.mean(covs, axis=0)
n_feats, _ = m.shape
# Select the `n_chan` channels having the maximum covariances.
all_max = []
for i in range(n_feats):
for j in range(n_feats):
if len(all_max) <= self.n_chan:
all_max.append(m[i, j])
else:
if m[i, j] > max(all_max): # This is line 76
all_max[np.argmin(all_max)] = m[i, j]
indices = []
for v in all_max:
indices.extend(np.argwhere(m == v).flatten())
# We will keep only these channels for the transform step.
indices = np.unique(indices)
self._chs_idx = indices
return self
It should be: if m[i, j] is greater than the minimum value, then replace it.
if m[i, j] > min(all_max):
all_max[np.argmin(all_max)] = m[i, j]
Can the entire code segment for finding the largest n values be optimized to?
np.partition(m.flatten(), -n_feats)[-n_feats:]
The text was updated successfully, but these errors were encountered:
In the official example plot_Hinss2021_classification.py (https://neurotechx.github.io/moabb/auto_examples/plot_Hinss2021_classification.html), is there a logical error on line 76?
It should be: if m[i, j] is greater than the minimum value, then replace it.
Can the entire code segment for finding the largest n values be optimized to?
The text was updated successfully, but these errors were encountered: