drawdata
drawdata copied to clipboard
Return type changes depending on user input; this is surprising and likely to break code
The data returned by ScatterWidget depends on user input, specifically whether the user only ever added points of one, or of more colors:
- one color only ("regression style"): widget.data_as_X_y returns X as an [N,1] shaped array of x coordinates and y as an [N] shaped array (vector) of y coordinates
- two+ colors ("classification style"): widget.data_as_X_y returns X as an [N,2] shaped array of x and y coordinates and y as an [N] shaped array of labels
It's great that the widget supports both regression and classification, but this makes it hard to build notebooks on top of it. Generally, I would want to handle both very differently. It would be great to be able to enforce at widget creation time that I (a) only want regression (and then don't provide the radio buttons for classes) or (b) only want classification (in which case always return X as [N,2] array and y as [N] array with labels, even if there is only a single class).