Skip to content

Commit

Permalink
[docs] add specific estimator names to sklearn fit() docs (#4774)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb authored Nov 8, 2021
1 parent cebdc2a commit 560a035
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python-package/lightgbm/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def __call__(self, preds, dataset):
Returns
-------
self : object
self : LGBMModel
Returns self.
"""
)
Expand Down Expand Up @@ -921,7 +921,7 @@ def fit(self, X, y,
categorical_feature=categorical_feature, callbacks=callbacks, init_model=init_model)
return self

_base_doc = LGBMModel.fit.__doc__
_base_doc = LGBMModel.fit.__doc__.replace("self : LGBMModel", "self : LGBMRegressor")
_base_doc = (_base_doc[:_base_doc.find('group :')] # type: ignore
+ _base_doc[_base_doc.find('eval_set :'):]) # type: ignore
_base_doc = (_base_doc[:_base_doc.find('eval_class_weight :')]
Expand Down Expand Up @@ -994,7 +994,7 @@ def fit(self, X, y,
callbacks=callbacks, init_model=init_model)
return self

_base_doc = LGBMModel.fit.__doc__
_base_doc = LGBMModel.fit.__doc__.replace("self : LGBMModel", "self : LGBMClassifier")
_base_doc = (_base_doc[:_base_doc.find('group :')] # type: ignore
+ _base_doc[_base_doc.find('eval_set :'):]) # type: ignore
fit.__doc__ = (_base_doc[:_base_doc.find('eval_group :')]
Expand Down Expand Up @@ -1093,7 +1093,7 @@ def fit(self, X, y,
categorical_feature=categorical_feature, callbacks=callbacks, init_model=init_model)
return self

_base_doc = LGBMModel.fit.__doc__
_base_doc = LGBMModel.fit.__doc__.replace("self : LGBMModel", "self : LGBMRanker")
fit.__doc__ = (_base_doc[:_base_doc.find('eval_class_weight :')] # type: ignore
+ _base_doc[_base_doc.find('eval_init_score :'):]) # type: ignore
_base_doc = fit.__doc__
Expand Down

0 comments on commit 560a035

Please sign in to comment.