Skip to content

Moving Transform: fails internally on sparse #276

@ajdapretnar

Description

@ajdapretnar
Timeseries version

0.6.2

Orange version

3.37.0.dev

Expected behavior

Moving Transform either:

  • issues an Error (can't transform sparse)
    or
  • works on sparse
Actual behavior

Moving Transform silently fails.

Steps to reproduce the behavior

Corpus - Bag of Words - Form Timeseries (sequence) - Moving Transform

Additional info (worksheets, data, screenshots, ...)

StackTrace:

2024-02-29 11:44:36,550:ERROR:resdk: 
Traceback (most recent call last):
  File "/Users/ajda/orange/orange3-timeseries/orangecontrib/timeseries/widgets/owmovingtransform.py", line 323, in _checkbox_changed
    self.commit.deferred()
  File "/Users/ajda/orange/orange-widget-base/orangewidget/gui.py", line 2006, in conditional_commit
    do_commit()
  File "/Users/ajda/orange/orange-widget-base/orangewidget/gui.py", line 2014, in do_commit
    commit.call()
  File "/Users/ajda/orange/orange-widget-base/orangewidget/gui.py", line 1879, in call
    acting_func(instance)
  File "/Users/ajda/orange/orange3-timeseries/orangecontrib/timeseries/widgets/owmovingtransform.py", line 375, in commit
    ts = [self._compute_sliding_window,
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ajda/orange/orange3-timeseries/orangecontrib/timeseries/widgets/owmovingtransform.py", line 425, in _compute_sliding_window
    add_aggregates(attr, column)
  File "/Users/ajda/orange/orange3-timeseries/orangecontrib/timeseries/widgets/owmovingtransform.py", line 416, in add_aggregates
    agg_column = agg.transform(column, self.window_width, 1)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ajda/orange/orange3-timeseries/orangecontrib/timeseries/aggregate.py", line 17, in moving_sum
    s = np.nancumsum(x)
        ^^^^^^^^^^^^^^^
  File "/Users/ajda/miniconda3/envs/o3/lib/python3.11/site-packages/numpy/lib/nanfunctions.py", line 876, in nancumsum
    a, mask = _replace_nan(a, 0)
              ^^^^^^^^^^^^^^^^^^
  File "/Users/ajda/miniconda3/envs/o3/lib/python3.11/site-packages/numpy/lib/nanfunctions.py", line 100, in _replace_nan
    mask = np.not_equal(a, a, dtype=bool)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ajda/miniconda3/envs/o3/lib/python3.11/site-packages/scipy/sparse/_base.py", line 332, in __bool__
    raise ValueError("The truth value of an array with more than one "
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions