[FIX] Fix varius deprecation (and other) warnings#1774
Merged
lanzagar merged 19 commits intobiolab:masterfrom Nov 25, 2016
Merged
[FIX] Fix varius deprecation (and other) warnings#1774lanzagar merged 19 commits intobiolab:masterfrom
lanzagar merged 19 commits intobiolab:masterfrom
Conversation
Replace random_integers with randint
Fix a 'DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will raise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.' from scikit-learn
Fix a 'VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future'
lanzagar
reviewed
Nov 24, 2016
Orange/regression/tree.py
Outdated
| score *= non_nans / len(col_x) | ||
| branches = (col_x > cut).astype(int) | ||
|
|
||
| with np.errstate(invalid="ignore"): # NaN in col_x handled later |
Contributor
There was a problem hiding this comment.
Wouldn't it be cleaner to initialize branches to -np.ones and set only the non-nan values after that.
Maybe it's just me, but I prefer not triggering errors to declaring which ones to ignore.
Contributor
|
Great stuff 👍 |
Current coverage is 88.96% (diff: 100%)@@ master #1774 diff @@
==========================================
Files 82 82
Lines 8853 8857 +4
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 7872 7880 +8
+ Misses 981 977 -4
Partials 0 0
|
Fix FutureDeprecationWarnings due to PEP 479
A OWWidget can be constructed only with only a mainArea (no controlArea, e.g. 'OWDistanceMatrix') in which case the constant index was incorect. Fixes a warning 'QSplitter::setCollapsible: Index 1 out of range' from Qt
Suppress a "FutureWarning: in the future, full(...) will return an
array of dtype('int64')"
Was broken since 2329179
Suppress a 'DeprecationWarning: numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead'
Suppress a warning from Qt ('QGraphicsScene::addItem: item has already
been added to this scene')
fe6e27c to
8eba817
Compare
In numpy 1.12b passing the distribution.Continuous instance as the
weight parameter to np.average triggers a:
File "..numpy/lib/function_base.py", line 1138, in average
if (scl == 0.0).any():
AttributeError: 'bool' object has no attribute 'any'
Passing a ndarray subclass to numpy.average triggers a:
FutureWarning: np.average currently does not preserve subclasses, but
will do so in the future to match the behavior of most other numpy
functions such as np.mean. In particular, this means calls which
returned a scalar may return a 0-d subclass object instead.
In this case this is not what we want.
Compute a 'weighted count' of NaNs if weights vector is supplied
lanzagar
approved these changes
Nov 25, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Current output from test shows quite a lot of warnings, which means that new ones are hard to spot.
Description of changes
Fix most of the easily avoidable warnings.
Includes