@@ -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."""
@@ -273,7 +273,14 @@ def serialize(self, data):
273
273
274
274
275
275
class LibSVMSerializer (BaseSerializer ):
276
- """Searilize data of various formats to a LibSVM-formatted string."""
276
+ """Serialize data of various formats to a LibSVM-formatted string.
277
+
278
+ The data must already be in LIBSVM file format:
279
+ <label> <index1>:<value1> <index2>:<value2> ...
280
+
281
+ It is suitable for sparse datasets since it does not store zero-valued
282
+ features.
283
+ """
277
284
278
285
CONTENT_TYPE = "text/libsvm"
279
286
@@ -293,4 +300,4 @@ def serialize(self, data):
293
300
if hasattr (data , "read" ):
294
301
return data .read ()
295
302
296
- raise ValueError ("Unable to handle input format: " , type (data ))
303
+ raise ValueError ("Unable to handle input format: %s" % type (data ))
0 commit comments