mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
parent
e5925daed3
commit
2ce73ce843
3 changed files with 13 additions and 63 deletions
|
@ -99,58 +99,8 @@ sys.modules["tensorflow"].VERSION = "9.9.9"
|
||||||
sys.modules["tensorflow.keras.callbacks"] = ChildClassMock()
|
sys.modules["tensorflow.keras.callbacks"] = ChildClassMock()
|
||||||
sys.modules["pytorch_lightning"] = ChildClassMock()
|
sys.modules["pytorch_lightning"] = ChildClassMock()
|
||||||
|
|
||||||
|
assert "ray" not in sys.modules, (
|
||||||
def import_or_mock(module):
|
"If ray is already imported, we will not render documentation correctly!")
|
||||||
try:
|
|
||||||
# Same as `import module`
|
|
||||||
__import__(module, globals(), locals(), [], 0)
|
|
||||||
except ImportError:
|
|
||||||
sys.modules[module] = ChildClassMock()
|
|
||||||
|
|
||||||
|
|
||||||
xgb_lgbm_modules = [
|
|
||||||
"xgboost", "xgboost.core", "xgboost.callback", "xgboost.sklearn",
|
|
||||||
"xgboost_ray", "lightgbm.main", "lightgbm.callback", "lightgbm.compat",
|
|
||||||
"lightgbm_ray"
|
|
||||||
]
|
|
||||||
for module in xgb_lgbm_modules:
|
|
||||||
import_or_mock(module)
|
|
||||||
|
|
||||||
# replace docstring refs in XGBoost documentation XGBoost-Ray inherits from
|
|
||||||
# if this is not done, an error during make will be thrown, as there is no
|
|
||||||
# such ref in ray docs
|
|
||||||
replaces_callback_api = [
|
|
||||||
sys.modules["xgboost_ray"].RayXGBClassifier.fit,
|
|
||||||
sys.modules["xgboost_ray"].RayXGBRegressor.fit
|
|
||||||
]
|
|
||||||
for m in replaces_callback_api:
|
|
||||||
m.__doc__ = m.__doc__.replace(":ref:`callback_api`", "Callback API")
|
|
||||||
|
|
||||||
# fix "more than one target found for cross-reference 'RayParams'"
|
|
||||||
# as both lightgbm-ray and xgboost-ray have classes with the same
|
|
||||||
# names, we need to refer to the explicitly in ray docs, otherwise
|
|
||||||
# make will throw an error
|
|
||||||
replaces_ray_params = [
|
|
||||||
sys.modules["xgboost_ray"].train, sys.modules["xgboost_ray"].predict,
|
|
||||||
sys.modules["xgboost_ray"].RayXGBClassifier.fit,
|
|
||||||
sys.modules["xgboost_ray"].RayXGBClassifier.predict,
|
|
||||||
sys.modules["xgboost_ray"].RayXGBClassifier.predict_proba,
|
|
||||||
sys.modules["xgboost_ray"].RayXGBRegressor.fit,
|
|
||||||
sys.modules["xgboost_ray"].RayXGBRegressor.predict
|
|
||||||
]
|
|
||||||
for m in replaces_ray_params:
|
|
||||||
m.__doc__ = m.__doc__.replace("RayParams", "xgboost_ray.RayParams")
|
|
||||||
|
|
||||||
replaces_ray_params = [
|
|
||||||
sys.modules["lightgbm_ray"].train, sys.modules["lightgbm_ray"].predict,
|
|
||||||
sys.modules["lightgbm_ray"].RayLGBMClassifier.fit,
|
|
||||||
sys.modules["lightgbm_ray"].RayLGBMClassifier.predict,
|
|
||||||
sys.modules["lightgbm_ray"].RayLGBMClassifier.predict_proba,
|
|
||||||
sys.modules["lightgbm_ray"].RayLGBMRegressor.fit,
|
|
||||||
sys.modules["lightgbm_ray"].RayLGBMRegressor.predict
|
|
||||||
]
|
|
||||||
for m in replaces_ray_params:
|
|
||||||
m.__doc__ = m.__doc__.replace("RayParams", "lightgbm_ray.RayParams")
|
|
||||||
|
|
||||||
|
|
||||||
class SimpleClass(object):
|
class SimpleClass(object):
|
||||||
|
|
|
@ -531,8 +531,8 @@ the `examples folder <https://github.com/ray-project/lightgbm_ray/tree/master/ex
|
||||||
API reference
|
API reference
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
.. autoclass:: lightgbm_ray.RayParams
|
.. .. autoclass:: lightgbm_ray.RayParams
|
||||||
:members:
|
.. :members:
|
||||||
|
|
||||||
.. autoclass:: xgboost_ray.RayDMatrix
|
.. autoclass:: xgboost_ray.RayDMatrix
|
||||||
:members:
|
:members:
|
||||||
|
|
|
@ -165,7 +165,7 @@ Things to keep in mind:
|
||||||
|
|
||||||
* ``n_jobs`` parameter controls the number of actors spawned.
|
* ``n_jobs`` parameter controls the number of actors spawned.
|
||||||
You can pass a ``RayParams`` object to the
|
You can pass a ``RayParams`` object to the
|
||||||
``fit``\ /\ ``predict``\ /\ ``predict_proba`` methods as the ``ray_params`` argument
|
``fit``\ /\ ``predict``\ /\ ``predict_proba`` methods as the ``ray_params`` argument
|
||||||
for greater control over resource allocation. Doing
|
for greater control over resource allocation. Doing
|
||||||
so will override the value of ``n_jobs`` with the value of
|
so will override the value of ``n_jobs`` with the value of
|
||||||
``ray_params.num_actors`` attribute. For more information, refer
|
``ray_params.num_actors`` attribute. For more information, refer
|
||||||
|
@ -611,14 +611,14 @@ API reference
|
||||||
scikit-learn API
|
scikit-learn API
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. autoclass:: xgboost_ray.RayXGBClassifier
|
.. .. autoclass:: xgboost_ray.RayXGBClassifier
|
||||||
:members:
|
.. :members:
|
||||||
|
|
||||||
.. autoclass:: xgboost_ray.RayXGBRegressor
|
.. .. autoclass:: xgboost_ray.RayXGBRegressor
|
||||||
:members:
|
.. :members:
|
||||||
|
|
||||||
.. autoclass:: xgboost_ray.RayXGBRFClassifier
|
.. .. autoclass:: xgboost_ray.RayXGBRFClassifier
|
||||||
:members:
|
.. :members:
|
||||||
|
|
||||||
.. autoclass:: xgboost_ray.RayXGBRFRegressor
|
.. .. autoclass:: xgboost_ray.RayXGBRFRegressor
|
||||||
:members:
|
.. :members:
|
Loading…
Add table
Reference in a new issue