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

[FIX] Fix varius deprecation (and other) warnings #1774

Merged
merged 19 commits into from
Nov 25, 2016

Conversation

ales-erjavec
Copy link
Contributor

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
  • Code changes
  • Tests
  • Documentation

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'
@@ -101,8 +101,11 @@ def _score_cont():
if score == 0:
return REJECT_ATTRIBUTE
score *= non_nans / len(col_x)
branches = (col_x > cut).astype(int)

with np.errstate(invalid="ignore"): # NaN in col_x handled later
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@lanzagar
Copy link
Contributor

Great stuff 👍

@codecov-io
Copy link

codecov-io commented Nov 24, 2016

Current coverage is 88.96% (diff: 100%)

Merging #1774 into master will increase coverage by 0.05%

@@             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          

Sunburst

Powered by Codecov. Last update 19f3594...6067f6d

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')
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 lanzagar added this to the 3.3.9 milestone Nov 25, 2016
@lanzagar lanzagar merged commit c10081d into biolab:master Nov 25, 2016
@astaric astaric modified the milestone: 3.3.9 Nov 28, 2016
@ales-erjavec ales-erjavec deleted the fixes/deprecation-warnings branch January 27, 2017 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants