Open jeremyhermann opened 6 months ago
Hi @jeremyhermann,
Thanks for submitting this issue. If you can provide a (minimal) reproducible example, I'll gladly further analyze why this error occurs.
Hi,
chiming in, I observed the same issue occur a while ago using PowerShap with Optuna .
I tracked it down to _TTestPower().solvepower call in utils.py issuing a warning
site-packages/statsmodels/stats/power.py:525: ConvergenceWarning: Failed to converge on a solution.
and returning a list instead of a scalar here:
In that case, after appending the result to _requirediterations list, we end up with inhomogeneous shape and it leads to an error during conversion of _requirediterations to numpy array here: https://github.com/predict-idlab/powershap/blob/4a60fbe79d67d311693e4c9a8616f81d652f2bb4/powershap/utils.py?plain=1#L72
Logging the _solvepower returns in each iteration:
[10.]
2.4867261850681004
2.6408546509597652
...
Here's a repro from trial that errored out for me.
The solution is maybe simply unpacking first value invariant if a scalar or a list: np.asarray(solved_power).flatten()[0]
before appending.
Let me know what you think.
@jvdd @JarneVerhaeghe - this appears highly similar to the error that I obtained when updating the dependencies.
I'm having the same error since upgrading to NumPy 1.24.1. Looks like it was caused by a breaking change in NumPy.
I'm still experiencing the same error, would it be possible to adjust the code to make it compatible with later versions of NumPy?
Do you know why I'd get this error when running PowerShap?