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.
name: "Pull request"
about: Make changes in scikit-uplift
📑 Description of the Change
In a recently updated Python environment the function uplift_by_percentile in sklift.metrics.metrics.py throws warning
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. return asarray(a).ndim
.If I add
the warning raises error at the following lines:
Versions of some of Python packages:
The line which raises error simply adds a row in the end of df. The rows values are provided as a list. The first element of the list is of type string. All the other elements are numpy.arrays of size 1. Without much of finding a justification for why this creates a warning, I just added [0] to the end of all
*_total
variables in these two lines and the warning does not appear any more.Verification Process
A simple code tests if this warning happens or not:
If I run this without changes in sklift, I get the error
After the correction the same code runs without any errors.
I
Release Notes
Fix deprecation warning in metrics.uplift_by_percentile.
Additional info