-
Notifications
You must be signed in to change notification settings - Fork 162
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
Update to Python-3.8 #254
Update to Python-3.8 #254
Conversation
Tests are broken, because transfer learning module uses non numeric extended labels. @plcrodrigues , any idea? |
I solve the problem, replacing |
This is indeed annoying but doesn't sound too hard to bypass with your In any case, we should soon take some time to make use of the new |
pyriemann/classification.py
Outdated
@@ -524,8 +523,8 @@ def predict(self, covtest): | |||
""" | |||
dist = self._predict_distances(covtest) | |||
neighbors_classes = self.classmeans_[np.argsort(dist)] | |||
out, _ = stats.mode(neighbors_classes[:, 0:self.n_neighbors], axis=1) | |||
return out.ravel() | |||
out = np.unique(neighbors_classes[:, 0:self.n_neighbors], axis=1)[:, 0] |
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.
I doubt this is correct
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.
you would need to use return_counts and get the entry in out that has the biggest count
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.
You are right. Solution for ndarray is a little bit more complicated
https://stackoverflow.com/a/12300214
I will try to find the simplest solution for 2D case.
pyriemann/classification.py
Outdated
@@ -524,8 +523,8 @@ def predict(self, covtest): | |||
""" | |||
dist = self._predict_distances(covtest) | |||
neighbors_classes = self.classmeans_[np.argsort(dist)] | |||
out, _ = stats.mode(neighbors_classes[:, 0:self.n_neighbors], axis=1) | |||
return out.ravel() | |||
out = np.unique(neighbors_classes[:, 0:self.n_neighbors], axis=1)[:, 0] |
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.
I'm not completely sure that this will work all the time. The KNearestNeighbor
is based on the idea of checking which class is the most common among the K nearest neighbors of the test point, right? Are we sure that np.unique
always returns the unique classes of the neighbors in a sorted way? This example makes me doubt it...
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.
You should probably use the output argument unique_counts
from np.unique
to be sure...
Last test for Windows Python 3.7 which is OK installed joblib 1.2.0 Now, it is KO installing joblib 1.3.1 I try to freeze joblib to 1.2.0, but now, all others tests for Python 3.8 and 3.9 are KO. Any idea? |
Last errors are due to scikit-learn 1.3.0, adding a new parameter |
Waiting scikit-learn bugfix, I decide to detect when _init_centroids must be used with a non default sample_weight. |
FYI I had a look and the joblib 1.3.1 issue is actually due to loky (default joblib parallel backend). The loky issue is tracked in joblib/loky#411. Not entirely sure this is going to get fixed in loky. FYI scikit-learn requires Python 3.8+ since scikit-learn 1.1 (released May 2022), so a possible work-around for pyRiemann would be to drop Python 3.7 support in the 0.5 release. |
Close-reopen for tests. |
Documentation fails, it is probably related to #255. @agramfort, what do you think ? EDIT: no, it is not related |
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.
thx @qbarthelemy
For documentation build, I can't solve the dependency problem between sphinx and jinja2. buid OK build KO build KO build KO |
Doc is now OK! |
Update to Python-3.8
Update code to support SciPy 1.11.0 and scikit-learn 1.3.0.
Update readme for version 0.5, see #253.