guillermo-navas-palencia / optbinning

Optimal binning: monotonic binning with constraints. Support batch & stream optimal binning. Scorecard modelling and counterfactual explanations.
http://gnpalencia.org/optbinning/
Apache License 2.0
452 stars 100 forks source link

Use np.empty/zeros dtype arg instead of astype'ing #273

Closed bmreiniger closed 10 months ago

bmreiniger commented 11 months ago

Hypothetical fix to #270.

I tried to replicate the issue there, but couldn't: the empty arrays were filled with zeros. So I'm not sure my guess there was correct. But while I was doing this, I ran timeit on the .astype vs dtype arg approaches, and the latter was significantly faster.

guillermo-navas-palencia commented 10 months ago

It makes sense. Thanks for your contribution!