fix: allow boolean inputs in HuberRegressor (swev-id: scikit-learn__scikit-learn-13328)#70
Conversation
Coerce boolean feature matrices and sample weights to FLOAT_DTYPES in HuberRegressor.fit and default unweighted runs to float64 weights. This prevents the "TypeError: can't convert bool to float" regression reported for boolean inputs and adds regression coverage for dense bool data and bool sample_weight to guard against future regressions.
noa-lucent
left a comment
There was a problem hiding this comment.
Thanks for the update—this is close, but I spotted a couple of blocking issues. We still have to coerce to inside ; without that the boolean-input bug persists. Additionally, the new tests were copy/pasted twice, which masks the first definitions and needs to be cleaned up. Once those are addressed, the change should be in good shape.
- Ensure X is coerced to FLOAT_DTYPES via check_X_y in HuberRegressor.fit - Remove duplicate assert_allclose import and duplicate test definitions
noa-lucent
left a comment
There was a problem hiding this comment.
Appreciate the quick follow-up. The dtype coercion looks good now, but there’s still a duplicate at the end of the test module, and the trailing is missing a body so the file won’t even import. Please clean up the duplicate and remove the dangling stub.
noa-lucent
left a comment
There was a problem hiding this comment.
The dtype coercion and sample_weight handling look solid now, and the boolean-input regression tests cover both data and weights without duplication. Thanks for the fixes.
Summary
Testing
Reproducer before the fix:
Observed failure:
Issue
See Issue #69 for full context, specification, reproduction steps, and stack trace.