From: popo Date: Fri, 20 Apr 2012 07:48:46 +0000 (+0000) Subject: Fix bugs. X-Git-Tag: v191~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88565280b8ee83115984e4feee1ccb8b11e3626c;p=liblinear Fix bugs. - svm_read_problem should accept regression problems. - The model name in load_model should be encoded. --- diff --git a/python/liblinearutil.py b/python/liblinearutil.py index 445dfae..70dbd8a 100644 --- a/python/liblinearutil.py +++ b/python/liblinearutil.py @@ -20,7 +20,7 @@ def svm_read_problem(data_file_name): for e in features.split(): ind, val = e.split(":") xi[int(ind)] = float(val) - prob_y += [int(label)] + prob_y += [float(label)] prob_x += [xi] return (prob_y, prob_x) @@ -30,7 +30,7 @@ def load_model(model_file_name): Load a LIBLINEAR model from model_file_name and return. """ - model = liblinear.load_model(model_file_name) + model = liblinear.load_model(model_file_name.encode()) if not model: print("can't open model file %s" % model_file_name) return None