Skip to content

[FIX] stats: Handle empty array#6221

Merged
janezd merged 1 commit intobiolab:masterfrom
VesnaT:fix_stats_empty_data
Nov 25, 2022
Merged

[FIX] stats: Handle empty array#6221
janezd merged 1 commit intobiolab:masterfrom
VesnaT:fix_stats_empty_data

Conversation

@VesnaT
Copy link
Contributor

@VesnaT VesnaT commented Nov 25, 2022

Issue

Fixes #6208 (comment)

Description of changes

Compute stats for an empty array / Table.

Includes
  • Code changes
  • Tests
  • Documentation

@janezd
Copy link
Contributor

janezd commented Nov 25, 2022

@VesnaT, I don't think this is correct fix. I'd even dare putting assert X.ndim == 2 here. I think we should always safely assume that X is two-dimensional, where X.shape[1] equals len(data.domain.attributes).

The problem is probably somewhere in class Table, which - as far as I see for now - constructs a zero-dim array when selecting zero rows. The problem must be fixed there; unless we prevent zero-dim arrays, everything will crash.

@markotoplak
Copy link
Member

@janezd, I dare to say you forgot about our beautiful data.Y, that can certainly be 1-dimensional (and plays the role of X here).

@janezd
Copy link
Contributor

janezd commented Nov 25, 2022

@markotoplak, you're wrong. I didn't forget that; at the time of writing I haven't gone deep enough yet, and I thought this is just about X (as in data.X). I didn't yet know this X could also be our beautiful shape-shifting Y. :)

@janezd janezd merged commit 1c3c00f into biolab:master Nov 25, 2022
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.

3 participants