예제 #1
0
def enable(name=None,
           verbose=True,
           deprecation=True,
           get_map=_get_map_of_algorithms):
    if name is not None:
        do_patch(name, get_map)
    else:
        for key in get_map():
            do_patch(key, get_map)
    if deprecation:
        set_idp_sklearn_verbose()
        warnings.warn_explicit(
            "\nScikit-learn patching with daal4py is deprecated "
            "and will be removed in the future.\n"
            "Use Intel(R) Extension "
            "for Scikit-learn* module instead "
            "(pip install scikit-learn-intelex).\n"
            "To enable patching, please use one of the "
            "following options:\n"
            "1) From the command line:\n"
            "    python -m sklearnex <your_script>\n"
            "2) From your script:\n"
            "    from sklearnex import patch_sklearn\n"
            "    patch_sklearn()", FutureWarning, "dispatcher.py", 151)
    if verbose and deprecation and sys.stderr is not None:
        sys.stderr.write(
            "Intel(R) oneAPI Data Analytics Library solvers for sklearn enabled: "
            "https://intelpython.github.io/daal4py/sklearn.html\n")
예제 #2
0
def enable(name=None, verbose=True, deprecation=True):
    if LooseVersion(sklearn_version) < LooseVersion("0.21.0"):
        raise NotImplementedError(
            "daal4py patches apply for scikit-learn >= 0.21.0 only ...")
    if name is not None:
        do_patch(name)
    else:
        for key in _get_map_of_algorithms():
            do_patch(key)
    if deprecation:
        set_idp_sklearn_verbose()
        warn(
            "Scikit-learn patching with daal4py is deprecated "
            "and will be removed in the future.\n"
            "Please, use Intel(R) Extension for Scikit-learn module instead "
            "(pip install scikit-learn-intelex)\n"
            "To enable patching, please, use one of options:\n"
            "1) python -m sklearnex <your_script>\n"
            "2) from sklearnex import patch_sklearn\n"
            "   patch_sklearn()",
            FutureWarning,
            stacklevel=2)
    if verbose and sys.stderr is not None:
        sys.stderr.write(
            "Intel(R) oneAPI Data Analytics Library solvers for sklearn enabled: "
            "https://intelpython.github.io/daal4py/sklearn.html\n")