[liblinear] 54/123: Add patch for solver missing from Python bindings

Christian Kastner chrisk-guest at moszumanska.debian.org
Tue Aug 26 03:42:08 UTC 2014


This is an automated email from the git hooks/post-receive script.

chrisk-guest pushed a commit to branch master
in repository liblinear.

commit f1d13dc2b1d0f4cdaa3aea08cb8c2f9d585a9988
Author: Christian Kastner <debian at kvr.at>
Date:   Fri Sep 17 22:58:42 2010 +0200

    Add patch for solver missing from Python bindings
---
 ...uild-shared-and-static-libraries-programs.patch |  2 +-
 ...003-Add-missing-solver-to-Python-bindings.patch | 64 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/debian/patches/0001-Properly-build-shared-and-static-libraries-programs.patch b/debian/patches/0001-Properly-build-shared-and-static-libraries-programs.patch
index cf94d87..195808d 100644
--- a/debian/patches/0001-Properly-build-shared-and-static-libraries-programs.patch
+++ b/debian/patches/0001-Properly-build-shared-and-static-libraries-programs.patch
@@ -12,7 +12,7 @@ Last-Update: 2010-07-09
  1 files changed, 32 insertions(+), 18 deletions(-)
 
 diff --git a/Makefile b/Makefile
-index 5004ff9..4d77d2f 100644
+index 5004ff9..8ad5303 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -1,27 +1,41 @@
diff --git a/debian/patches/0003-Add-missing-solver-to-Python-bindings.patch b/debian/patches/0003-Add-missing-solver-to-Python-bindings.patch
new file mode 100644
index 0000000..976442b
--- /dev/null
+++ b/debian/patches/0003-Add-missing-solver-to-Python-bindings.patch
@@ -0,0 +1,64 @@
+From: Christian Kastner <debian at kvr.at>
+Date: Fri, 17 Sep 2010 22:44:45 +0200
+Subject: [PATCH] Add missing solver to Python bindings
+
+Apparently, The solver for the dual form of logistic regression that was added to the
+library in 1.7 was accidentally omitted from the Python bindings.
+
+Forwarded: no
+Last-Update: 2010-09-17
+---
+ python/linear.py     |    4 ++--
+ python/linearutil.py |    5 +++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/python/linear.py b/python/linear.py
+index 145f60f..0cf6ca5 100644
+--- a/python/linear.py
++++ b/python/linear.py
+@@ -17,7 +17,7 @@ else:
+ 
+ # Construct constants
+ SOLVER_TYPE = ['L2R_LR', 'L2R_L2LOSS_SVC_DUAL', 'L2R_L2LOSS_SVC', 'L2R_L1LOSS_SVC_DUAL',\
+-		'MCSVM_CS', 'L1R_L2LOSS_SVC', 'L1R_LR']
++		'MCSVM_CS', 'L1R_L2LOSS_SVC', 'L1R_LR', 'L2R_LR_DUAL']
+ for i, s in enumerate(SOLVER_TYPE): exec("%s = %d" % (s , i))
+ 
+ PRINT_STRING_FUN = CFUNCTYPE(None, c_char_p)
+@@ -182,7 +182,7 @@ class parameter(Structure):
+ 		if self.eps == float('inf'):
+ 			if self.solver_type in [L2R_LR, L2R_L2LOSS_SVC]:
+ 				self.eps = 0.01
+-			elif self.solver_type in [L2R_L2LOSS_SVC_DUAL, L2R_L1LOSS_SVC_DUAL, MCSVM_CS]:
++			elif self.solver_type in [L2R_L2LOSS_SVC_DUAL, L2R_L1LOSS_SVC_DUAL, MCSVM_CS, L2R_LR_DUAL]:
+ 				self.eps = 0.1
+ 			elif self.solver_type in [L1R_L2LOSS_SVC, L1R_LR]:
+ 				self.eps = 0.01
+diff --git a/python/linearutil.py b/python/linearutil.py
+index 77b510e..9607608 100644
+--- a/python/linearutil.py
++++ b/python/linearutil.py
+@@ -74,19 +74,20 @@ def train(arg1, arg2=None, arg3=None):
+ 
+ 	'options':
+ 		-s type : set type of solver (default 1)
+-			0 -- L2-regularized logistic regression
++			0 -- L2-regularized logistic regression (primal)
+ 			1 -- L2-regularized L2-loss support vector classification (dual)	
+ 			2 -- L2-regularized L2-loss support vector classification (primal)
+ 			3 -- L2-regularized L1-loss support vector classification (dual)
+ 			4 -- multi-class support vector classification by Crammer and Singer
+ 			5 -- L1-regularized L2-loss support vector classification
+ 			6 -- L1-regularized logistic regression
++			7 -- L2-regularized logistic regression (dual)
+ 		-c cost : set the parameter C (default 1)
+ 		-e epsilon : set tolerance of termination criterion
+ 			-s 0 and 2 
+ 				|f'(w)|_2 <= eps*min(pos,neg)/l*|f'(w0)|_2, 
+ 				where f is the primal function, (default 0.01)
+-			-s 1, 3, and 4
++			-s 1, 3, 4 and 7
+ 				Dual maximal violation <= eps; similar to liblinear (default 0.1)
+ 			-s 5 and 6
+ 				|f'(w)|_inf <= eps*min(pos,neg)/l*|f'(w0)|_inf,
+-- 
diff --git a/debian/patches/series b/debian/patches/series
index 5187293..f618954 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-Properly-build-shared-and-static-libraries-programs.patch
 0002-Move-Python-bindings-to-package-liblinear.patch
+0003-Add-missing-solver-to-Python-bindings.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/liblinear.git



More information about the debian-science-commits mailing list