-
Notifications
You must be signed in to change notification settings - Fork 346
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 deprecation warning for np array #360
base: main
Are you sure you want to change the base?
Conversation
/databricks/python/lib/python3.8/site-packages/tslearn/barycenters/softdtw.py:103: 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 X_ = numpy.array([to_time_series(d, remove_nans=True) for d in X_]) Because this method often uses numpy arrays with different shapes, I think the approach is justified here.
Codecov Report
@@ Coverage Diff @@
## main #360 +/- ##
==========================================
+ Coverage 94.71% 94.74% +0.02%
==========================================
Files 59 59
Lines 4525 4525
==========================================
+ Hits 4286 4287 +1
+ Misses 239 238 -1
Continue to review full report at Codecov.
|
Hi @brk21 Thanks for pointing out this deprecation warning! It seems to me that it is not even necessary to cast the list into a numpy array, or is it? Couldn't we do something like: X_ = [to_time_series(Xi, remove_nans=True) for Xi in X_] ? |
Hi @rtavenar, I think you are right, but I also think we will generate the same warning in the https://github.com/tslearn-team/tslearn/blob/main/tslearn/utils/utils.py#L146 So you may end up adding the Please let me know if I can support in any way. Ross |
I would like to avoid the |
@rtavenar I would be strongly opposed to that because one of the main values of If you wanted to port |
I meant raising a |
Phew @rtavenar Apologies for the misunderstanding. Yes, I would be fine with that. |
/databricks/python/lib/python3.8/site-packages/tslearn/barycenters/softdtw.py:103: 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
X_ = numpy.array([to_time_series(d, remove_nans=True) for d in X_])
Because this method often uses numpy arrays with different shapes, I think the approach is justified here.