25
25
from .. import __version__
26
26
27
27
from ..utils import check_array , IS_PYPY
28
+ from ..utils ._param_validation import validate_params , HasMethods
28
29
29
30
if not IS_PYPY :
30
31
from ._svmlight_format_fast import (
@@ -404,6 +405,17 @@ def _dump_svmlight(X, y, f, multilabel, one_based, comment, query_id):
404
405
)
405
406
406
407
408
+ @vali
10000
date_params (
409
+ {
410
+ "X" : ["array-like" , "sparse matrix" ],
411
+ "y" : ["array-like" , "sparse matrix" ],
412
+ "f" : [str , HasMethods (["write" ])],
413
+ "zero_based" : ["boolean" ],
414
+ "comment" : [str , bytes , None ],
415
+ "query_id" : ["array-like" , None ],
416
+ "multilabel" : ["boolean" ],
417
+ }
418
+ )
407
419
def dump_svmlight_file (
408
420
X ,
409
421
y ,
@@ -428,7 +440,7 @@ def dump_svmlight_file(
428
440
Training vectors, where `n_samples` is the number of samples and
429
441
`n_features` is the number of features.
430
442
431
- y : {array-like, sparse matrix}, shape = [ n_samples ( , n_labels)]
443
+ y : {array-like, sparse matrix}, shape = ( n_samples,) or (n_samples , n_labels)
432
444
Target values. Class labels must be an
433
445
integer or float, or array-like objects of integer or float for
434
446
multilabel classifications.
@@ -442,7 +454,7 @@ def dump_svmlight_file(
442
454
Whether column indices should be written zero-based (True) or one-based
443
455
(False).
444
456
445
- comment : str, default=None
457
+ comment : str or bytes , default=None
446
458
Comment to insert at the top of the file. This should be either a
447
459
Unicode string, which will be encoded as UTF-8, or an ASCII byte
448
460
string.
@@ -459,7 +471,7 @@ def dump_svmlight_file(
459
471
https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multilabel.html).
460
472
461
473
.. versionadded:: 0.17
462
- parameter * multilabel* to support multilabel datasets.
474
+ parameter ` multilabel` to support multilabel datasets.
463
475
"""
464
476
if comment is not None :
465
477
# Convert comment string to list of lines in UTF-8.
0 commit comments