From: ppetter1025 Date: Thu, 26 Jul 2018 14:39:36 +0000 (+0800) Subject: In svm_read_problem we removed zeros while reading data. Changed to keep them for... X-Git-Tag: v221~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3bf1a49aef0cbaf6170903163a6d63f5f351b8cd;p=liblinear In svm_read_problem we removed zeros while reading data. Changed to keep them for consistency with LIBSVM (for which zeros must be kept for pre-computed kernels) --- diff --git a/python/liblinearutil.py b/python/liblinearutil.py index d5cc033..d3f3015 100644 --- a/python/liblinearutil.py +++ b/python/liblinearutil.py @@ -47,8 +47,7 @@ def svm_read_problem(data_file_name, return_scipy=False): xi = {} for e in features.split(): ind, val = e.split(":") - if float(val) != 0: - xi[int(ind)] = float(val) + xi[int(ind)] = float(val) prob_x += [xi] if scipy != None and return_scipy: prob_y = scipy.array(prob_y)