mirror of
https://github.com/elastic/eland.git
synced 2025-07-11 00:02:14 +08:00
Add deprecation warning for ESGradientBoostingModel subclasses (#738)
Introduce a warning indicating that exporting data frame analytics models as ESGradientBoostingModel subclasses is deprecated and will be removed in version 9.0.0. The implementation of ESGradientBoostingModel relies on importing undocumented private classes that were changed in 1.4 to https://github.com/scikit-learn/scikit-learn/pull/26278. This dependency makes the code difficult to maintain, while the functionality is not widely used by users. Therefore, we will deprecate this functionality in 8.16 and remove it completely in 9.0.0. --------- Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co>
This commit is contained in:
parent
79d9a6ae29
commit
9aec8fc751
@ -15,6 +15,8 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
|
||||||
from ._version import ( # noqa: F401
|
from ._version import ( # noqa: F401
|
||||||
__author__,
|
__author__,
|
||||||
__author_email__,
|
__author_email__,
|
||||||
@ -25,13 +27,16 @@ from ._version import ( # noqa: F401
|
|||||||
__url__,
|
__url__,
|
||||||
__version__,
|
__version__,
|
||||||
)
|
)
|
||||||
from .common import SortOrder
|
from .common import ElandDeprecationWarning, SortOrder
|
||||||
from .dataframe import DataFrame
|
from .dataframe import DataFrame
|
||||||
from .etl import csv_to_eland, eland_to_pandas, pandas_to_eland
|
from .etl import csv_to_eland, eland_to_pandas, pandas_to_eland
|
||||||
from .index import Index
|
from .index import Index
|
||||||
from .ndframe import NDFrame
|
from .ndframe import NDFrame
|
||||||
from .series import Series
|
from .series import Series
|
||||||
|
|
||||||
|
# Display Eland deprecation warnings by default
|
||||||
|
warnings.simplefilter("default", category=ElandDeprecationWarning)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"DataFrame",
|
"DataFrame",
|
||||||
"Series",
|
"Series",
|
||||||
|
@ -52,6 +52,10 @@ PANDAS_VERSION: Tuple[int, ...] = tuple(
|
|||||||
_ELAND_MAJOR_VERSION = int(_eland_version.split(".")[0])
|
_ELAND_MAJOR_VERSION = int(_eland_version.split(".")[0])
|
||||||
|
|
||||||
|
|
||||||
|
class ElandDeprecationWarning(DeprecationWarning):
|
||||||
|
"""Warning for deprecation functionality in Eland"""
|
||||||
|
|
||||||
|
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("ignore")
|
warnings.simplefilter("ignore")
|
||||||
EMPTY_SERIES_DTYPE = pd.Series().dtype
|
EMPTY_SERIES_DTYPE = pd.Series().dtype
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import warnings
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
from typing import Any, List, Literal, Mapping, Optional, Set, Tuple, Union
|
from typing import Any, List, Literal, Mapping, Optional, Set, Tuple, Union
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ from sklearn.ensemble._gb_losses import (
|
|||||||
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
|
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
|
||||||
from sklearn.utils.validation import check_array
|
from sklearn.utils.validation import check_array
|
||||||
|
|
||||||
from eland.common import ensure_es_client
|
from eland.common import ElandDeprecationWarning, ensure_es_client
|
||||||
from eland.ml.common import TYPE_CLASSIFICATION, TYPE_REGRESSION
|
from eland.ml.common import TYPE_CLASSIFICATION, TYPE_REGRESSION
|
||||||
|
|
||||||
from ._sklearn_deserializers import Tree
|
from ._sklearn_deserializers import Tree
|
||||||
@ -62,6 +63,10 @@ class ESGradientBoostingModel(ABC):
|
|||||||
model_id : str
|
model_id : str
|
||||||
The unique identifier of the trained inference model in Elasticsearch.
|
The unique identifier of the trained inference model in Elasticsearch.
|
||||||
|
|
||||||
|
Deprecation Warning:
|
||||||
|
------
|
||||||
|
Exporting data frame analytics models as ESGradientBoostingModel subclasses is deprecated and will be removed in version 9.0.0.
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
------
|
------
|
||||||
RuntimeError
|
RuntimeError
|
||||||
@ -70,6 +75,11 @@ class ESGradientBoostingModel(ABC):
|
|||||||
The model is expected to be trained in Elastic Stack. Models initially imported
|
The model is expected to be trained in Elastic Stack. Models initially imported
|
||||||
from xgboost, lgbm, or sklearn are not supported.
|
from xgboost, lgbm, or sklearn are not supported.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn(
|
||||||
|
"Exporting data frame analytics models as ESGradientBoostingModel subclasses is deprecated and will be removed in version 9.0.0.",
|
||||||
|
ElandDeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
self.es_client: Elasticsearch = ensure_es_client(es_client)
|
self.es_client: Elasticsearch = ensure_es_client(es_client)
|
||||||
self.model_id = model_id
|
self.model_id = model_id
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user