@@ -54,7 +54,7 @@ def CONTENT_TYPE(self):
54
54
55
55
56
56
class CSVSerializer (BaseSerializer ):
57
- """Searilize data of various formats to a CSV-formatted string."""
57
+ """Serialize data of various formats to a CSV-formatted string."""
58
58
59
59
CONTENT_TYPE = "text/csv"
60
60
@@ -102,7 +102,7 @@ def _serialize_row(self, data):
102
102
csv_writer .writerow (data )
103
103
return csv_buffer .getvalue ().rstrip ("\r \n " )
104
104
105
- raise ValueError ("Unable to handle input format: " , type (data ))
105
+ raise ValueError ("Unable to handle input format: %s" % type (data ))
106
106
107
107
def _is_sequence_like (self , data ):
108
108
"""Returns true if obj is iterable and subscriptable."""
@@ -244,7 +244,14 @@ def serialize(self, data):
244
244
245
245
246
246
class LibSVMSerializer (BaseSerializer ):
247
- """Searilize data of various formats to a LibSVM-formatted string."""
247
+ """Serialize data of various formats to a LibSVM-formatted string.
248
+
249
+ The data must already be in LIBSVM file format:
250
+ <label> <index1>:<value1> <index2>:<value2> ...
251
+
252
+ It is suitable for sparse datasets since it does not store zero-valued
253
+ features.
254
+ """
248
255
249
256
CONTENT_TYPE = "text/libsvm"
250
257
@@ -264,4 +271,4 @@ def serialize(self, data):
264
271
if hasattr (data , "read" ):
265
272
return data .read ()
266
273
267
- raise ValueError ("Unable to handle input format: " , type (data ))
274
+ raise ValueError ("Unable to handle input format: %s" % type (data ))
0 commit comments