From 1343ce92ec519ef9db1ab01fd86a068b25fe3693 Mon Sep 17 00:00:00 2001 From: rofu Date: Mon, 14 Jun 2010 15:32:43 +0000 Subject: [PATCH] - Fix typos in README - Change setBias to set_bias in python --- README | 2 +- python/README | 6 +++--- python/linear.py | 4 ++-- python/linearutil.py | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README b/README index 4607d62..351db30 100644 --- a/README +++ b/README @@ -413,7 +413,7 @@ Library Usage This function returns a pointer to the model read from the file, or a null pointer if the model could not be loaded. -- Function: void free_model_contents(struct model *model_ptr); +- Function: void free_model_content(struct model *model_ptr); This function frees the memory used by the entries in a model structure. diff --git a/python/README b/python/README index 36a6e4c..426d92d 100644 --- a/python/README +++ b/python/README @@ -51,7 +51,7 @@ in linearutil.py and the usage is the same as the LIBLINEAR MATLAB interface. >>> p_label, p_acc, p_val = predict(y[200:], x[200:], m) # Construct problem in python format -# Dense data, the first element of the dense data must be 0 +# Dense data >>> y, x = [1,-1], [[1,0,1], [-1,0,-1]] # Sparse data >>> y, x = [1,-1], [{1:1, 3:1}, {1:-1,3:-1}] @@ -150,7 +150,7 @@ LIBLINEAR shared library: You can alos modify the bias value by - >>> prob.setBias(1) + >>> prob.set_bias(1) Note that if your x contains sparse data (i.e., dictionary), the internal ctypes data format is still sparse. @@ -213,7 +213,7 @@ To use utility functions, type The above command loads train() : train an linear model predict() : predict testing data - svm_read_problem() : read the data from a LIBLINEAR-format file. + svm_read_problem() : read the data from a LIBSVM-format file. load_model() : load a LIBLINEAR model. save_model() : save model to a file. evaluations() : evaluate prediction results. diff --git a/python/linear.py b/python/linear.py index 8b04ab3..e9d5efa 100644 --- a/python/linear.py +++ b/python/linear.py @@ -88,9 +88,9 @@ class problem(Structure): self.x = (POINTER(feature_node) * l)() for i, xi in enumerate(self.x_space): self.x[i] = xi - self.setBias(bias) + self.set_bias(bias) - def setBias(self, bias): + def set_bias(self, bias): if self.bias == bias: return if bias >= 0 and self.bias < 0: diff --git a/python/linearutil.py b/python/linearutil.py index ef65113..06cd1c3 100755 --- a/python/linearutil.py +++ b/python/linearutil.py @@ -41,7 +41,7 @@ def save_model(model_file_name, model): """ save_model(model_file_name, model) -> None - Save a LIBLINEAR model model to the file model_file_name. + Save a LIBLINEAR model to the file model_file_name. """ liblinear.save_model(model_file_name, model) @@ -67,7 +67,7 @@ def train(arg1, arg2=None, arg3=None): train(prob, [, 'options']) -> model | ACC train(prob, param) -> model | ACC - Train an SVM linear model from data (y, x) or a problem prob using + Train a model from data (y, x) or a problem prob using 'options' or a parameter param. If '-v' is specified in 'options' (i.e., cross validation) accuracy (ACC) is returned. @@ -111,7 +111,7 @@ def train(arg1, arg2=None, arg3=None): if prob == None or param == None : raise TypeError("Wrong types for the arguments") - prob.setBias(param.bias) + prob.set_bias(param.bias) liblinear.set_print_string_function(param.print_func) err_msg = liblinear.check_parameter(prob, param) if err_msg : -- 2.50.1