Support doc link for the sklearn module. (#10287)
This commit is contained in:
@@ -14,7 +14,7 @@ dependencies:
|
||||
- pylint
|
||||
- numpy
|
||||
- scipy
|
||||
- scikit-learn
|
||||
- scikit-learn>=1.4.1
|
||||
- pandas
|
||||
- matplotlib
|
||||
- dask
|
||||
|
||||
@@ -11,7 +11,7 @@ dependencies:
|
||||
- numpy
|
||||
- scipy
|
||||
- llvm-openmp
|
||||
- scikit-learn
|
||||
- scikit-learn>=1.4.1
|
||||
- pandas
|
||||
- matplotlib
|
||||
- dask
|
||||
|
||||
@@ -6,7 +6,7 @@ dependencies:
|
||||
- wheel
|
||||
- numpy
|
||||
- scipy
|
||||
- scikit-learn
|
||||
- scikit-learn>=1.4.1
|
||||
- pandas
|
||||
- matplotlib
|
||||
- dask
|
||||
|
||||
@@ -9,6 +9,7 @@ import pytest
|
||||
|
||||
import xgboost as xgb
|
||||
from xgboost import testing as tm
|
||||
from xgboost.core import _parse_version
|
||||
|
||||
dpath = "demo/data/"
|
||||
rng = np.random.RandomState(1994)
|
||||
@@ -315,3 +316,14 @@ class TestBasicPathLike:
|
||||
"""An invalid model_file path should raise XGBoostError."""
|
||||
with pytest.raises(xgb.core.XGBoostError):
|
||||
xgb.Booster(model_file=Path("invalidpath"))
|
||||
|
||||
|
||||
def test_parse_ver() -> None:
|
||||
(major, minor, patch), post = _parse_version("2.1.0")
|
||||
assert post == ""
|
||||
(major, minor, patch), post = _parse_version("2.1.0-dev")
|
||||
assert post == "dev"
|
||||
(major, minor, patch), post = _parse_version("2.1.0rc1")
|
||||
assert post == "rc1"
|
||||
(major, minor, patch), post = _parse_version("2.1.0.post1")
|
||||
assert post == "post1"
|
||||
|
||||
@@ -1484,3 +1484,16 @@ def test_tags() -> None:
|
||||
|
||||
tags = xgb.XGBRanker()._more_tags()
|
||||
assert "multioutput" not in tags
|
||||
|
||||
|
||||
def test_doc_link() -> None:
|
||||
for est in [
|
||||
xgb.XGBRegressor(),
|
||||
xgb.XGBClassifier(),
|
||||
xgb.XGBRanker(),
|
||||
xgb.XGBRFRegressor(),
|
||||
xgb.XGBRFClassifier(),
|
||||
]:
|
||||
name = est.__class__.__name__
|
||||
link = est._get_doc_link()
|
||||
assert f"xgboost.{name}" in link
|
||||
|
||||
@@ -35,6 +35,7 @@ from hypothesis import HealthCheck, assume, given, note, settings
|
||||
from sklearn.datasets import make_classification, make_regression
|
||||
|
||||
import xgboost as xgb
|
||||
from xgboost import dask as dxgb
|
||||
from xgboost import testing as tm
|
||||
from xgboost.data import _is_cudf_df
|
||||
from xgboost.testing.params import hist_cache_strategy, hist_parameter_strategy
|
||||
@@ -2324,3 +2325,16 @@ async def test_worker_restarted(c, s, a, b):
|
||||
d_train,
|
||||
evals=[(d_train, "train")],
|
||||
)
|
||||
|
||||
|
||||
def test_doc_link() -> None:
|
||||
for est in [
|
||||
dxgb.DaskXGBRegressor(),
|
||||
dxgb.DaskXGBClassifier(),
|
||||
dxgb.DaskXGBRanker(),
|
||||
dxgb.DaskXGBRFRegressor(),
|
||||
dxgb.DaskXGBRFClassifier(),
|
||||
]:
|
||||
name = est.__class__.__name__
|
||||
link = est._get_doc_link()
|
||||
assert f"xgboost.dask.{name}" in link
|
||||
|
||||
Reference in New Issue
Block a user