News for hackers. Stuff that matters.
Re:Intel Extension for Scikit-Learn by evanb on Monday November 01, 2021 @11:43AM (#29068246)
The syntax and usability of

    from sklearnex import patch_sklearn
    # The names match scikit-learn estimators
    patch_sklearn("SVC")
seems quite clunky. I'd have preferred a syntax like

    from sklearnex import SVC
    
Then, maintenance would be substantially easier. If sklearnex had import-level compatibility with sklearn it'd be as simple as some simple replacements,

    import sklearn --> import sklearnex as sklearn

    from sklearn.cluster import KMeans --> from sklearnex.cluster import KMeans
which seems much easier / clearer.
Re:Intel Extension for Scikit-Learn by sillysaurusx on Monday November 01, 2021 @12:13PM (#29068764)
Import magic ends up causing all kinds of problems. There's no way to tell it "I just want to import your classes; I don't want you to patch!" without literally patching the library.

In general, I'm a fan of "let me call the initializer myself, at program startup." It's especially important when you want reversibility, i.e. teardown in addition to initialization, which pops up all the time for unit tests.

Re:Intel Extension for Scikit-Learn by dangerbird2 on Monday November 01, 2021 @01:27PM (#29069906)
Also networking/web apps with lifecycle hooks, where careless import-time logic can break the setup procedures. To quote zen of python, "explicit is better than implicit"
Re:Intel Extension for Scikit-Learn by sdenton4 on Monday November 01, 2021 @11:55AM (#29068448)
I really really loathe import magics. You end up with situations where dependencies change global behavior without a way to track down where the change is actually coming from.
Re:Intel Extension for Scikit-Learn by napetrov on Friday November 12, 2021 @09:13AM (#29199401)
patching is just one of options to enable optimizations - You also can do already sklearnex import SVC

There are other ways how you can enable this https://intel.github.io/scikit-learn-intelex/what-is-patchin...