From f538c8fa4d78e9f622d706922d38b1c16afd9c99 Mon Sep 17 00:00:00 2001 From: Chih-Jen Lin Date: Sun, 24 May 2020 17:27:09 +0800 Subject: [PATCH] Fix one comment in linear.cpp and a description of get_decfun_bias() in python/README --- linear.cpp | 3 ++- python/README | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/linear.cpp b/linear.cpp index c873156..e2965eb 100644 --- a/linear.cpp +++ b/linear.cpp @@ -3482,7 +3482,8 @@ static inline double get_w_value(const struct model *model_, int idx, int label_ // feat_idx: starting from 1 to nr_feature // label_idx: starting from 0 to nr_class-1 for classification models; -// for regression models, label_idx is ignored. +// for regression and one-class SVM models, label_idx is +// ignored. double get_decfun_coef(const struct model *model_, int feat_idx, int label_idx) { if(feat_idx > model_->nr_feature) diff --git a/python/README b/python/README index 1403ab9..6449974 100644 --- a/python/README +++ b/python/README @@ -286,11 +286,12 @@ LIBLINEAR shared library: >>> b = model_.get_decfun_bias() >>> [W, b] = model_.get_decfun() - For one-class SVM models, label_idx is ignored and b=-rho is returned. That - is, the decision function is w*x+b=w*x-rho. + For one-class SVM models, label_idx is ignored and b=-rho is + returned from get_decfun(). That is, the decision function is + w*x+b = w*x-rho. >>> rho = model_.get_decfun_rho() - >>> [W, rho] = model_.get_decfun() + >>> [W, b] = model_.get_decfun() Note that in get_decfun_coef, get_decfun_bias, and get_decfun, feat_idx starts from 1, while label_idx starts from 0. If label_idx is not in the -- 2.40.0