Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC Ensures that load_svmlight_files passes numpydoc validation #24164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions sklearn/datasets/_svmlight_format_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def load_svmlight_files(
offset=0,
length=-1,
):
"""Load dataset from multiple files in SVMlight format
"""Load dataset from multiple files in SVMlight format.

This function is equivalent to mapping load_svmlight_file over a list of
files, except that the results are concatenated into a single, flat list
Expand Down Expand Up @@ -268,7 +268,7 @@ def load_svmlight_files(

multilabel : bool, default=False
Samples may have several labels each (see
https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multilabel.html)
https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multilabel.html).

zero_based : bool or "auto", default="auto"
Whether column indices in f are zero-based (True) or one-based
Expand Down Expand Up @@ -296,23 +296,22 @@ def load_svmlight_files(

Returns
-------
[X1, y1, ..., Xn, yn]
where each (Xi, yi) pair is the result from load_svmlight_file(files[i]).
[X1, y1, ..., Xn, yn] or [X1, y1, q1, ..., Xn, yn, qn]: list of arrays
Each (Xi, yi) pair is the result from load_svmlight_file(files[i]).
If query_id is set to True, this will return instead (Xi, yi, qi)
triplets.

If query_id is set to True, this will return instead [X1, y1, q1,
..., Xn, yn, qn] where (Xi, yi, qi) is the result from
load_svmlight_file(files[i])
See Also
--------
load_svmlight_file: Similar function for loading a single file in this
format.

Notes
-----
When fitting a model to a matrix X_train and evaluating it against a
matrix X_test, it is essential that X_train and X_test have the same
number of features (X_train.shape[1] == X_test.shape[1]). This may not
be the case if you load the files individually with load_svmlight_file.

See Also
--------
load_svmlight_file
"""
if (offset != 0 or length > 0) and zero_based == "auto":
# disable heuristic search to avoid getting inconsistent results on
Expand Down
1 change: 0 additions & 1 deletion sklearn/tests/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"sklearn.datasets._lfw.fetch_lfw_people",
"sklearn.datasets._species_distributions.fetch_species_distributions",
"sklearn.datasets._svmlight_format_io.load_svmlight_file",
"sklearn.datasets._svmlight_format_io.load_svmlight_files",
"sklearn.decomposition._dict_learning.dict_learning",
"sklearn.decomposition._dict_learning.dict_learning_online",
"sklearn.decomposition._nmf.non_negative_factorization",
Expand Down