# lazy evaluation to allow import without dynamic library, e.g., for docs generation
# lazy evaluation to allow import without dynamic library, e.g., for docs generation
aliases=None
aliases=None
...
@@ -1112,7 +1100,7 @@ class _InnerPredictor:
...
@@ -1112,7 +1100,7 @@ class _InnerPredictor:
Parameters
Parameters
----------
----------
data : str, pathlib.Path, numpy array, pandas DataFrame, pyarrow Table, H2O DataTable's Frame (deprecated) or scipy.sparse
data : str, pathlib.Path, numpy array, pandas DataFrame, pyarrow Table or scipy.sparse
Data source for prediction.
Data source for prediction.
If str or pathlib.Path, it represents the path to a text file (CSV, TSV, or LibSVM).
If str or pathlib.Path, it represents the path to a text file (CSV, TSV, or LibSVM).
start_iteration : int, optional (default=0)
start_iteration : int, optional (default=0)
...
@@ -1225,14 +1213,6 @@ class _InnerPredictor:
...
@@ -1225,14 +1213,6 @@ class _InnerPredictor:
num_iteration=num_iteration,
num_iteration=num_iteration,
predict_type=predict_type,
predict_type=predict_type,
)
)
elifisinstance(data,dt_DataTable):
_emit_datatable_deprecation_warning()
preds,nrow=self.__pred_for_np2d(
mat=data.to_numpy(),
start_iteration=start_iteration,
num_iteration=num_iteration,
predict_type=predict_type,
)
else:
else:
try:
try:
_log_warning("Converting data to scipy sparse matrix.")
_log_warning("Converting data to scipy sparse matrix.")
...
@@ -1790,7 +1770,7 @@ class Dataset:
...
@@ -1790,7 +1770,7 @@ class Dataset:
Parameters
Parameters
----------
----------
data : str, pathlib.Path, numpy array, pandas DataFrame, H2O DataTable's Frame (deprecated), scipy.sparse, Sequence, list of Sequence, list of numpy array or pyarrow Table
data : str, pathlib.Path, numpy array, pandas DataFrame, scipy.sparse, Sequence, list of Sequence, list of numpy array or pyarrow Table
Data source of Dataset.
Data source of Dataset.
If str or pathlib.Path, it represents the path to a text file (CSV, TSV, or LibSVM) or a LightGBM Dataset binary file.
If str or pathlib.Path, it represents the path to a text file (CSV, TSV, or LibSVM) or a LightGBM Dataset binary file.
label : list, numpy 1-D array, pandas Series / one-column DataFrame, pyarrow Array, pyarrow ChunkedArray or None, optional (default=None)
label : list, numpy 1-D array, pandas Series / one-column DataFrame, pyarrow Array, pyarrow ChunkedArray or None, optional (default=None)
...
@@ -2196,9 +2176,6 @@ class Dataset:
...
@@ -2196,9 +2176,6 @@ class Dataset:
raiseTypeError("Data list can only be of ndarray or Sequence")
raiseTypeError("Data list can only be of ndarray or Sequence")
data : str, pathlib.Path, numpy array, pandas DataFrame, H2O DataTable's Frame (deprecated), scipy.sparse, Sequence, list of Sequence or list of numpy array
data : str, pathlib.Path, numpy array, pandas DataFrame, scipy.sparse, Sequence, list of Sequence or list of numpy array
Data source of Dataset.
Data source of Dataset.
If str or pathlib.Path, it represents the path to a text file (CSV, TSV, or LibSVM) or a LightGBM Dataset binary file.
If str or pathlib.Path, it represents the path to a text file (CSV, TSV, or LibSVM) or a LightGBM Dataset binary file.
label : list, numpy 1-D array, pandas Series / one-column DataFrame, pyarrow Array, pyarrow ChunkedArray or None, optional (default=None)
label : list, numpy 1-D array, pandas Series / one-column DataFrame, pyarrow Array, pyarrow ChunkedArray or None, optional (default=None)
...
@@ -3276,7 +3253,7 @@ class Dataset:
...
@@ -3276,7 +3253,7 @@ class Dataset:
Returns
Returns
-------
-------
data : str, pathlib.Path, numpy array, pandas DataFrame, H2O DataTable's Frame (deprecated), scipy.sparse, Sequence, list of Sequence or list of numpy array or None
data : str, pathlib.Path, numpy array, pandas DataFrame, scipy.sparse, Sequence, list of Sequence or list of numpy array or None
data : str, pathlib.Path, numpy array, pandas DataFrame, pyarrow Table, H2O DataTable's Frame (deprecated) or scipy.sparse
data : str, pathlib.Path, numpy array, pandas DataFrame, pyarrow Table or scipy.sparse
Data source for prediction.
Data source for prediction.
If str or pathlib.Path, it represents the path to a text file (CSV, TSV, or LibSVM).
If str or pathlib.Path, it represents the path to a text file (CSV, TSV, or LibSVM).
start_iteration : int, optional (default=0)
start_iteration : int, optional (default=0)
...
@@ -4798,7 +4751,7 @@ class Booster:
...
@@ -4798,7 +4751,7 @@ class Booster:
Parameters
Parameters
----------
----------
data : str, pathlib.Path, numpy array, pandas DataFrame, H2O DataTable's Frame (deprecated), scipy.sparse, Sequence, list of Sequence or list of numpy array
data : str, pathlib.Path, numpy array, pandas DataFrame, scipy.sparse, Sequence, list of Sequence or list of numpy array
Data source for refit.
Data source for refit.
If str or pathlib.Path, it represents the path to a text file (CSV, TSV, or LibSVM).
If str or pathlib.Path, it represents the path to a text file (CSV, TSV, or LibSVM).
label : list, numpy 1-D array, pandas Series / one-column DataFrame, pyarrow Array or pyarrow ChunkedArray
label : list, numpy 1-D array, pandas Series / one-column DataFrame, pyarrow Array or pyarrow ChunkedArray
@@ -1077,7 +1075,7 @@ class LGBMModel(_LGBMModelBase):
...
@@ -1077,7 +1075,7 @@ class LGBMModel(_LGBMModelBase):
fit.__doc__=(
fit.__doc__=(
_lgbmmodel_doc_fit.format(
_lgbmmodel_doc_fit.format(
X_shape="numpy array, pandas DataFrame, H2O DataTable's Frame (deprecated), scipy.sparse, list of lists of int or float of shape = [n_samples, n_features]",
X_shape="numpy array, pandas DataFrame, scipy.sparse, list of lists of int or float of shape = [n_samples, n_features]",
y_shape="numpy array, pandas DataFrame, pandas Series, list of int or float of shape = [n_samples]",
y_shape="numpy array, pandas DataFrame, pandas Series, list of int or float of shape = [n_samples]",
sample_weight_shape="numpy array, pandas Series, list of int or float of shape = [n_samples] or None, optional (default=None)",
sample_weight_shape="numpy array, pandas Series, list of int or float of shape = [n_samples] or None, optional (default=None)",
init_score_shape="numpy array, pandas DataFrame, pandas Series, list of int or float of shape = [n_samples] or shape = [n_samples * n_classes] (for multi-class task) or shape = [n_samples, n_classes] (for multi-class task) or None, optional (default=None)",
init_score_shape="numpy array, pandas DataFrame, pandas Series, list of int or float of shape = [n_samples] or shape = [n_samples * n_classes] (for multi-class task) or shape = [n_samples, n_classes] (for multi-class task) or None, optional (default=None)",
...
@@ -1104,7 +1102,7 @@ class LGBMModel(_LGBMModelBase):
...
@@ -1104,7 +1102,7 @@ class LGBMModel(_LGBMModelBase):
"""Docstring is set after definition, using a template."""
"""Docstring is set after definition, using a template."""
ifnotself.__sklearn_is_fitted__():
ifnotself.__sklearn_is_fitted__():
raiseLGBMNotFittedError("Estimator not fitted, call fit before exploiting the model.")
raiseLGBMNotFittedError("Estimator not fitted, call fit before exploiting the model.")
ifnotisinstance(X,(pd_DataFrame,dt_DataTable)):
ifnotisinstance(X,pd_DataFrame):
X=_LGBMValidateData(
X=_LGBMValidateData(
self,
self,
X,
X,
...
@@ -1154,7 +1152,7 @@ class LGBMModel(_LGBMModelBase):
...
@@ -1154,7 +1152,7 @@ class LGBMModel(_LGBMModelBase):
predict.__doc__=_lgbmmodel_doc_predict.format(
predict.__doc__=_lgbmmodel_doc_predict.format(
description="Return the predicted value for each sample.",
description="Return the predicted value for each sample.",
X_shape="numpy array, pandas DataFrame, H2O DataTable's Frame (deprecated), scipy.sparse, list of lists of int or float of shape = [n_samples, n_features]",
X_shape="numpy array, pandas DataFrame, scipy.sparse, list of lists of int or float of shape = [n_samples, n_features]",
output_name="predicted_result",
output_name="predicted_result",
predicted_result_shape="array-like of shape = [n_samples] or shape = [n_samples, n_classes]",
predicted_result_shape="array-like of shape = [n_samples] or shape = [n_samples, n_classes]",
X_leaves_shape="array-like of shape = [n_samples, n_trees] or shape = [n_samples, n_trees * n_classes]",
X_leaves_shape="array-like of shape = [n_samples, n_trees] or shape = [n_samples, n_trees * n_classes]",
...
@@ -1648,7 +1646,7 @@ class LGBMClassifier(_LGBMClassifierBase, LGBMModel):
...
@@ -1648,7 +1646,7 @@ class LGBMClassifier(_LGBMClassifierBase, LGBMModel):
description="Return the predicted probability for each class for each sample.",
description="Return the predicted probability for each class for each sample.",
X_shape="numpy array, pandas DataFrame, H2O DataTable's Frame (deprecated), scipy.sparse, list of lists of int or float of shape = [n_samples, n_features]",
X_shape="numpy array, pandas DataFrame, scipy.sparse, list of lists of int or float of shape = [n_samples, n_features]",
output_name="predicted_probability",
output_name="predicted_probability",
predicted_result_shape="array-like of shape = [n_samples] or shape = [n_samples, n_classes]",
predicted_result_shape="array-like of shape = [n_samples] or shape = [n_samples, n_classes]",
X_leaves_shape="array-like of shape = [n_samples, n_trees] or shape = [n_samples, n_trees * n_classes]",
X_leaves_shape="array-like of shape = [n_samples, n_trees] or shape = [n_samples, n_trees * n_classes]",