diff --git a/doc/modules/glm.rst b/doc/modules/glm.rst index 8a1937810d8d58d97a40206aad3d8d8ab9d50a6e..ccf4911935804f3f67c610e1240fafe826c7cde6 100644 --- a/doc/modules/glm.rst +++ b/doc/modules/glm.rst @@ -91,8 +91,8 @@ greater the amount of shrinkage. Ridge(alpha=0.5, fit_intercept=True) >>> clf.coef_ array([ 0.34545455, 0.34545455]) - >>> clf.intercept_ - 0.13636363636363638 + >>> clf.intercept_ #doctest: +ELLIPSIS + 0.13636... Ridge Complexity -------------------- diff --git a/doc/modules/svm.rst b/doc/modules/svm.rst index 14a72be8aa0903c03c1da04a24f1ded461b4b5e9..b26cb72b4995207821660992cfb637689a78f858 100644 --- a/doc/modules/svm.rst +++ b/doc/modules/svm.rst @@ -83,8 +83,7 @@ training data, called the support vectors. These vectors can be accessed in member `support_`: >>> clf.support_ - array([[ 0., 0.], - [ 1., 1.]]) + array([0, 1], dtype=int32) Member `n_support_` holds the number of support vectors for each class: diff --git a/examples/logistic_l1_l2_coef.py b/examples/logistic_l1_l2_coef.py index eafe036c877ca6ba945ce07816c4938303be90a5..4c5847cb4dffe07e2a9ee6f3fea0e8ab91007a7c 100644 --- a/examples/logistic_l1_l2_coef.py +++ b/examples/logistic_l1_l2_coef.py @@ -12,7 +12,7 @@ with l1 and l2 penalty import numpy as np -from scikits.learn.logistic import LogisticRegression +from scikits.learn.glm import LogisticRegression from scikits.learn import datasets iris = datasets.load_iris() diff --git a/examples/mlcomp_sparse_document_classification.py b/examples/mlcomp_sparse_document_classification.py index 70f91c2ccc0e0ee0d231bacfc0aee601da29a434..639678cf29a17325fa90cf4ff61c750e940aca30 100644 --- a/examples/mlcomp_sparse_document_classification.py +++ b/examples/mlcomp_sparse_document_classification.py @@ -43,7 +43,7 @@ import scipy.sparse as sp import pylab as pl from scikits.learn.datasets import load_mlcomp -from scikits.learn.sparse.svm import LinearSVC +from scikits.learn.svm.sparse import LinearSVC from scikits.learn.metrics import confusion_matrix if 'MLCOMP_DATASETS_HOME' not in os.environ: diff --git a/examples/plot_classification_probability.py b/examples/plot_classification_probability.py index 2bfea661c5799f0a9d5dbf61b9811efc57f09066..96881661539fbe5ad30dec4b9865341f523493f7 100644 --- a/examples/plot_classification_probability.py +++ b/examples/plot_classification_probability.py @@ -18,7 +18,7 @@ a result it can identify only the first class. import pylab as pl import numpy as np -from scikits.learn.logistic import LogisticRegression +from scikits.learn.glm import LogisticRegression from scikits.learn.svm import SVC from scikits.learn import datasets diff --git a/scikits/learn/__init__.py b/scikits/learn/__init__.py index e0861fc5e3a4729a0c63911e9e900d40a813931b..525d0c608f611fb3b1e3329e2a3dff4829ee8801 100644 --- a/scikits/learn/__init__.py +++ b/scikits/learn/__init__.py @@ -21,7 +21,6 @@ from . import covariance from . import datasets from . import gmm from . import glm -from . import logistic from . import lda from . import metrics from . import svm @@ -43,9 +42,9 @@ try: except: pass -__all__ = ['cross_val', 'ball_tree', 'cluster', 'covariance', 'datasets', 'gmm', 'glm', - 'logistic', 'lda', 'metrics', 'svm', 'features', 'clone', - 'test'] +__all__ = ['cross_val', 'ball_tree', 'cluster', 'covariance', + 'datasets', 'gmm', 'glm', 'lda', 'metrics', 'svm', + 'features', 'clone', 'test'] __version__ = '0.6.git' diff --git a/scikits/learn/cluster/tests/test_spectral.py b/scikits/learn/cluster/tests/test_spectral.py index 1c73c8410d081ec5d135b458949346c9424b4202..fbb2687dbbd188b4a65e5c90aac5f4c328dd7885 100644 --- a/scikits/learn/cluster/tests/test_spectral.py +++ b/scikits/learn/cluster/tests/test_spectral.py @@ -6,6 +6,7 @@ Testing for Clustering methods import numpy as np from numpy.testing import assert_equal from scipy import sparse +import nose from .. import SpectralClustering @@ -31,6 +32,7 @@ def test_spectral_clustering(): def test_spectral_clustering_sparse(): # We need a large matrice, or the lobpcg solver will fallback to its # non-sparse and buggy mode + raise nose.SkipTest("XFailed Test") S = np.array([[1, 5, 2, 2, 1, 0, 0, 0, 0, 0], [5, 1, 3, 2, 1, 0, 0, 0, 0, 0], [2, 3, 1, 1, 1, 0, 0, 0, 0, 0], diff --git a/scikits/learn/glm/__init__.py b/scikits/learn/glm/__init__.py index 4c1d7e708637903bf49af2a3597db875a265fe85..82dfbef111f2dc7bf05642b5f9da94448db428f5 100644 --- a/scikits/learn/glm/__init__.py +++ b/scikits/learn/glm/__init__.py @@ -16,5 +16,6 @@ from .lars import LARS, LassoLARS, lars_path from .coordinate_descent import Lasso, ElasticNet, LassoCV, ElasticNetCV, \ lasso_path, enet_path from .ridge import Ridge +from .logistic import LogisticRegression from . import sparse diff --git a/scikits/learn/logistic.py b/scikits/learn/glm/logistic.py similarity index 68% rename from scikits/learn/logistic.py rename to scikits/learn/glm/logistic.py index d2cab0dd28cbdf2565d42e1f0bc7f6bbaf46032d..bc23e5b994c87eb256587fed837c047cf9f3fe41 100644 --- a/scikits/learn/logistic.py +++ b/scikits/learn/glm/logistic.py @@ -1,8 +1,8 @@ import numpy as np -from .base import ClassifierMixin -from .svm.base import BaseLibLinear -from .svm import _liblinear +from ..base import ClassifierMixin +from ..svm.base import BaseLibLinear +from ..svm import _liblinear class LogisticRegression(BaseLibLinear, ClassifierMixin): """ @@ -12,15 +12,14 @@ class LogisticRegression(BaseLibLinear, ClassifierMixin): Parameters ---------- - X : array-like, shape = [n_samples, n_features] - Training vector, where n_samples in the number of samples and - n_features is the number of features. - Y : array, shape = [n_samples] - Target vector relative to X penalty : string, 'l1' or 'l2' Used to specify the norm used in the penalization + dual : boolean + Dual or primal formulation. Dual formulation is only + implemented for l2 penalty. + C : float Specifies the strength of the regularization. The smaller it is the bigger in the regularization. @@ -57,14 +56,25 @@ class LogisticRegression(BaseLibLinear, ClassifierMixin): http://www.csie.ntu.edu.tw/~cjlin/liblinear/ """ - def __init__(self, penalty='l2', eps=1e-4, C=1.0, fit_intercept=True): - super(LogisticRegression, self).__init__ (penalty=penalty, loss='lr', - dual=False, eps=eps, C=C, fit_intercept=fit_intercept) + def __init__(self, penalty='l2', dual=False, eps=1e-4, C=1.0, + fit_intercept=True): + + super(LogisticRegression, self).__init__ (penalty=penalty, + dual=dual, loss='lr', eps=eps, C=C, + fit_intercept=fit_intercept) def predict_proba(self, T): + """ + Probability estimates. + + The returned estimates for all classes are ordered by the + label of classes. + """ T = np.asanyarray(T, dtype=np.float64, order='C') - return _liblinear.predict_prob_wrap(T, self.raw_coef_, self._get_solver_type(), + probas = _liblinear.predict_prob_wrap(T, self.raw_coef_, + self._get_solver_type(), self.eps, self.C, self._weight_label, self._weight, self.label_, self._get_bias()) + return probas[:,np.argsort(self.label_)] diff --git a/scikits/learn/glm/sparse/logistic.py b/scikits/learn/glm/sparse/logistic.py new file mode 100644 index 0000000000000000000000000000000000000000..981101132fcfe0e5826bb8586ca02cd7de9dd9c1 --- /dev/null +++ b/scikits/learn/glm/sparse/logistic.py @@ -0,0 +1,90 @@ +""" +Sparse Logistic Regression module + +This module has the same API as scikits.learn.glm.logistic, but is +designed to handle efficiently data in sparse matrix format. +""" + +import numpy as np +from scipy import sparse + +from ...base import ClassifierMixin +from ...svm.base import BaseLibLinear +from ...svm._liblinear import csr_predict_prob + +class LogisticRegression(BaseLibLinear, ClassifierMixin): + """ + Logistic Regression. + + Implements L1 and L2 regularized logistic regression. + + Parameters + ---------- + + penalty : string, 'l1' or 'l2' + Used to specify the norm used in the penalization + + dual : boolean + Dual or primal formulation. Dual formulation is only + implemented for l2 penalty. + + C : float + Specifies the strength of the regularization. The smaller it is + the bigger in the regularization. + + fit_intercept : bool, default: True + Specifies if a constant (a.k.a. bias or intercept) should be + added the decision function + + Attributes + ---------- + + `coef_` : array, shape = [n_classes-1, n_features] + Coefficient of the features in the decision function. + + `intercept_` : array, shape = [n_classes-1] + intercept (a.k.a. bias) added to the decision function. + It is available only when parameter intercept is set to True + + Methods + ------- + fit(X, Y) : self + Fit the model + + predict(X) : array + Predict using the model. + + See also + -------- + LinearSVC + + References + ---------- + LIBLINEAR -- A Library for Large Linear Classification + http://www.csie.ntu.edu.tw/~cjlin/liblinear/ + """ + + def __init__(self, penalty='l2', dual=False, eps=1e-4, C=1.0, + fit_intercept=True): + + super(LogisticRegression, self).__init__ (penalty=penalty, + dual=dual, loss='lr', eps=eps, C=C, + fit_intercept=fit_intercept) + + def predict_proba(self, T): + """ + Probability estimates. + + The returned estimates for all classes are ordered by the + label of classes. + """ + T = sparse.csr_matrix(T) + T.data = np.asanyarray(T.data, dtype=np.float64, order='C') + probas = csr_predict_prob(T.shape[1], T.data, T.indices, + T.indptr, self.raw_coef_, + self._get_solver_type(), + self.eps, self.C, + self._weight_label, + self._weight, self.label_, + self._get_bias()) + return probas[:,np.argsort(self.label_)] diff --git a/scikits/learn/tests/test_logistic.py b/scikits/learn/glm/sparse/tests/test_logistic.py similarity index 72% rename from scikits/learn/tests/test_logistic.py rename to scikits/learn/glm/sparse/tests/test_logistic.py index 8c55c57a3b8ae9f5ba953be022312d7a62da5ecb..e7a71f577b5e147abb4c93296fcf248d42b6cf20 100644 --- a/scikits/learn/tests/test_logistic.py +++ b/scikits/learn/glm/sparse/tests/test_logistic.py @@ -5,11 +5,12 @@ from numpy.testing import assert_array_equal, \ import nose from nose.tools import assert_raises -from .. import logistic, datasets +from scikits.learn.glm.sparse import logistic +from scikits.learn import datasets X = [[-1, 0], [0, 1], [1, 1]] Y1 = [0, 1, 1] -Y2 = [0, 1, 2] +Y2 = [2, 1, 0] iris = datasets.load_iris() def test_predict_2_classes(): @@ -53,15 +54,8 @@ def test_predict_iris(): pred = clf.predict_proba(iris.data).argmax(axis=1) assert np.mean(pred == iris.target) > .95 -def test_predict_proba(): - """ - I think this test is wrong. Is there a way to know the right results ? - """ - raise nose.SkipTest("XFailed test") - clf = logistic.LogisticRegression().fit(X, Y2) - assert_array_almost_equal(clf.predict_proba([[1, 1]]), - [[ 0.21490268, 0.32639437, 0.45870294]]) - - clf = logistic.LogisticRegression(penalty='l1').fit(X, Y2) - assert_array_almost_equal(clf.predict_proba([[2, 2]]), - [[ 0.33333333, 0.33333333, 0.33333333]]) + + +if __name__ == '__main__': + import nose + nose.runmodule() diff --git a/scikits/learn/glm/tests/test_logistic.py b/scikits/learn/glm/tests/test_logistic.py new file mode 100644 index 0000000000000000000000000000000000000000..6621a978ae98feb05d6ae44a923e9e1419ae1c29 --- /dev/null +++ b/scikits/learn/glm/tests/test_logistic.py @@ -0,0 +1,60 @@ +import numpy as np + +from numpy.testing import assert_array_equal, \ + assert_array_almost_equal +import nose +from nose.tools import assert_raises + +from scikits.learn.glm import logistic +from scikits.learn import datasets + +X = [[-1, 0], [0, 1], [1, 1]] +Y1 = [0, 1, 1] +Y2 = [2, 1, 0] +iris = datasets.load_iris() + +def test_predict_2_classes(): + """ + Simple sanity check on a 2 classes dataset. + Make sure it predicts the correct result on simple datasets. + """ + clf = logistic.LogisticRegression().fit(X, Y1) + assert_array_equal(clf.predict(X), Y1) + assert_array_equal(clf.predict_proba(X).argmax(axis=1), Y1) + + clf = logistic.LogisticRegression(C=100).fit(X, Y1) + assert_array_equal(clf.predict(X), Y1) + assert_array_equal(clf.predict_proba(X).argmax(axis=1), Y1) + + clf = logistic.LogisticRegression(fit_intercept=False).fit(X, Y1) + assert_array_equal(clf.predict(X), Y1) + assert_array_equal(clf.predict_proba(X).argmax(axis=1), Y1) + + +def test_error(): + """ + test for appropriate exception on errors + """ + assert_raises (ValueError, logistic.LogisticRegression(C=-1).fit, X, Y1) + + +def test_predict_3_classes(): + clf = logistic.LogisticRegression(C=10).fit(X, Y2) + assert_array_equal(clf.predict(X), Y2) + assert_array_equal(clf.predict_proba(X).argmax(axis=1), Y2) + +def test_predict_iris(): + """Test logisic regression with the iris dataset""" + + clf = logistic.LogisticRegression().fit(iris.data, iris.target) + + pred = clf.predict(iris.data) + assert np.mean(pred == iris.target) > .95 + + pred = clf.predict_proba(iris.data).argmax(axis=1) + assert np.mean(pred == iris.target) > .95 + + +if __name__ == '__main__': + import nose + nose.runmodule() diff --git a/scikits/learn/svm/base.py b/scikits/learn/svm/base.py index 7e06dafa7249c3a17ca1281b4ab850f585be08ee..307a01e77c0c7ac585a3e5a29ef3e36748819247 100644 --- a/scikits/learn/svm/base.py +++ b/scikits/learn/svm/base.py @@ -234,17 +234,15 @@ class BaseLibLinear(BaseEstimator): Base for classes binding liblinear (dense and sparse versions) """ - _weight_label = np.empty(0, dtype=np.int32) - _weight = np.empty(0, dtype=np.float64) - _solver_type_dict = { - 'PL2_LLR_D0' : 0, # L2 penalty logistic regression - 'PL2_LL2_D1' : 1, # L2 penalty, L2 loss, dual problem - 'PL2_LL2_D0' : 2, # L2 penalty, L2 loss, primal problem - 'PL2_LL1_D1' : 3, # L2 penalty, L1 Loss, dual problem + 'PL2_LLR_D0' : 0, # L2 penalty, logistic regression + 'PL2_LL2_D1' : 1, # L2 penalty, L2 loss, dual form + 'PL2_LL2_D0' : 2, # L2 penalty, L2 loss, primal form + 'PL2_LL1_D1' : 3, # L2 penalty, L1 Loss, dual form 'MC_SVC' : 4, # Multi-class Support Vector Classification - 'PL1_LL2_D0' : 5, # L1 penalty, L2 Loss, primal problem - 'PL1_LLR_D0' : 6, # L1 penalty logistic regression + 'PL1_LL2_D0' : 5, # L1 penalty, L2 Loss, primal form + 'PL1_LLR_D0' : 6, # L1 penalty, logistic regression + 'PL2_LLR_D1' : 7, # L2 penalty, logistic regression, dual form } def __init__(self, penalty='l2', loss='l2', dual=True, eps=1e-4, C=1.0, @@ -256,6 +254,10 @@ class BaseLibLinear(BaseEstimator): self.C = C self.fit_intercept = fit_intercept self.multi_class = multi_class + + self._weight_label = np.empty(0, dtype=np.int32) + self._weight = np.empty(0, dtype=np.float64) + # Check that the arguments given are valid: self._get_solver_type() @@ -343,7 +345,7 @@ class BaseLibLinear(BaseEstimator): return self.raw_coef_ def predict_proba(self, T): - # how can this be, logisitic *does* implement this + # only available for logistic regression raise NotImplementedError( 'liblinear does not provide this functionality') diff --git a/scikits/learn/svm/setup.py b/scikits/learn/svm/setup.py index de938c5c681db5f4180d337b5124c908ecd85c1f..af7f1bcb7c1286f8adf24b2f4c29150ae317d7de 100644 --- a/scikits/learn/svm/setup.py +++ b/scikits/learn/svm/setup.py @@ -11,20 +11,23 @@ def configuration(parent_package='', top_path=None): config = Configuration('svm', parent_package, top_path) config.add_subpackage('tests') - config.add_subpackage('sparse') # Section LibSVM - libsvm_includes = [numpy.get_include()] - libsvm_sources = [join('src', 'libsvm', '_libsvm.c'), - join('src', 'libsvm', 'svm.cpp')] - libsvm_depends = [join('src', 'libsvm', 'svm.h'), - join('src', 'libsvm', 'libsvm_helper.c')] + + # we compile both libsvm and lisvm_sparse + config.add_library('libsvm-skl', + sources=[join('src', 'libsvm', 'libsvm_template.cpp')], + depends=[join('src', 'libsvm', 'svm.cpp'), + join('src', 'libsvm', 'svm.h')] + ) + libsvm_sources = [join('src', 'libsvm', '_libsvm.c')] + libsvm_depends = [join('src', 'libsvm', 'libsvm_helper.c')] config.add_extension('_libsvm', sources=libsvm_sources, - define_macros=[('_DENSE_REP', 1)], - include_dirs=libsvm_includes, - depends=libsvm_depends, + include_dirs=[numpy.get_include()], + libraries=['libsvm-skl'], + depends=libsvm_depends ) ### liblinear module @@ -53,10 +56,15 @@ def configuration(parent_package='', top_path=None): numpy.get_include(), blas_info.pop('include_dirs', [])], depends=liblinear_depends, + # extra_compile_args=['-O0 -fno-inline'], **blas_info) ## end liblinear module + # this should go *after* libsvm-skl + config.add_subpackage('sparse') + + return config diff --git a/scikits/learn/svm/sparse/liblinear.py b/scikits/learn/svm/sparse/liblinear.py index d14fbe3214554dfd8eacae29ef792898e892880b..d7be77787cedd1062c3bb0307a16aa64e0f17c87 100644 --- a/scikits/learn/svm/sparse/liblinear.py +++ b/scikits/learn/svm/sparse/liblinear.py @@ -50,12 +50,6 @@ class LinearSVC(BaseLibLinear, ClassifierMixin): `intercept_` : array, shape = [n_classes-1] constants in decision function - - Notes - ----- - Some features of liblinear are still not wrapped, like the Cramer - & Singer algorithm. - References ---------- LIBLINEAR -- A Library for Large Linear Classification @@ -63,14 +57,10 @@ class LinearSVC(BaseLibLinear, ClassifierMixin): """ - _weight_label = np.empty(0, dtype=np.int32) - _weight = np.empty(0, dtype=np.float64) - - def fit(self, X, Y, **params): """ Parameters - ========== + ---------- X : array-like, shape = [n_samples, n_features] Training vector, where n_samples in the number of samples and n_features is the number of features. diff --git a/scikits/learn/svm/sparse/setup.py b/scikits/learn/svm/sparse/setup.py index 9ea0a38b0530e3013cb16026548364d514c1458d..a6a23bb33f093641d76def52ce3948fad25c67ea 100644 --- a/scikits/learn/svm/sparse/setup.py +++ b/scikits/learn/svm/sparse/setup.py @@ -11,12 +11,13 @@ def configuration(parent_package='', top_path=None): config = Configuration('sparse', parent_package, top_path) - libsvm_sparse_sources = [join('..', 'src', 'libsvm', '_libsvm_sparse.c'), - join('..', 'src', 'libsvm', 'svm.cpp')] + libsvm_sparse_sources = [join('..', 'src', 'libsvm', '_libsvm_sparse.c')] config.add_extension('_libsvm_sparse', + libraries=['libsvm-skl'], sources=libsvm_sparse_sources, - include_dirs=[numpy.get_include()], + include_dirs=[numpy.get_include(), + join('..', 'src', 'libsvm')], depends=[join('..', 'src', 'libsvm', 'svm.h'), join('..', 'src', 'libsvm', 'libsvm_sparse_helper.c')], ) diff --git a/scikits/learn/svm/src/liblinear/COPYRIGHT b/scikits/learn/svm/src/liblinear/COPYRIGHT new file mode 100644 index 0000000000000000000000000000000000000000..1ea278f1cb080634aa4c034ed455f019cc62a72b --- /dev/null +++ b/scikits/learn/svm/src/liblinear/COPYRIGHT @@ -0,0 +1,31 @@ + +Copyright (c) 2007-2010 The LIBLINEAR Project. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +3. Neither name of copyright holders nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/scikits/learn/svm/src/liblinear/_liblinear.c b/scikits/learn/svm/src/liblinear/_liblinear.c index eeb0a68a7a76b7b2e9d93ce576b7034e3b3b9635..483ffc9a441f4181ddb6cc8aa4e4300574189160 100644 --- a/scikits/learn/svm/src/liblinear/_liblinear.c +++ b/scikits/learn/svm/src/liblinear/_liblinear.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.12.1 on Thu Aug 19 18:59:08 2010 */ +/* Generated by Cython 0.12.1 on Fri Oct 22 11:47:09 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -658,10 +658,11 @@ static char __pyx_k_5[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_6[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_7[] = "Format string allocated too short."; static char __pyx_k_8[] = "\nWrapper for liblinear\n\nAuthor: fabian.pedregosa@inria.fr\n"; -static char __pyx_k_9[] = "train_wrap (line 44)"; -static char __pyx_k_10[] = "csr_train_wrap (line 95)"; -static char __pyx_k_11[] = "csr_predict_wrap (line 178)"; -static char __pyx_k_12[] = "predict_prob_wrap (line 218)"; +static char __pyx_k_9[] = "train_wrap (line 51)"; +static char __pyx_k_10[] = "csr_train_wrap (line 102)"; +static char __pyx_k_11[] = "csr_predict_wrap (line 185)"; +static char __pyx_k_12[] = "predict_prob_wrap (line 225)"; +static char __pyx_k_13[] = "csr_predict_prob (line 279)"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; static char __pyx_k__H[] = "H"; @@ -727,12 +728,14 @@ static char __pyx_k__solver_type[] = "solver_type"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k__weight_label[] = "weight_label"; static char __pyx_k__csr_train_wrap[] = "csr_train_wrap"; +static char __pyx_k__csr_predict_prob[] = "csr_predict_prob"; static char __pyx_k__csr_predict_wrap[] = "csr_predict_wrap"; static char __pyx_k__predict_prob_wrap[] = "predict_prob_wrap"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_u_10; static PyObject *__pyx_kp_u_11; static PyObject *__pyx_kp_u_12; +static PyObject *__pyx_kp_u_13; static PyObject *__pyx_kp_u_2; static PyObject *__pyx_kp_u_3; static PyObject *__pyx_kp_u_4; @@ -760,6 +763,7 @@ static PyObject *__pyx_n_s__bias; static PyObject *__pyx_n_s__buf; static PyObject *__pyx_n_s__byteorder; static PyObject *__pyx_n_s__coef_; +static PyObject *__pyx_n_s__csr_predict_prob; static PyObject *__pyx_n_s__csr_predict_wrap; static PyObject *__pyx_n_s__csr_train_wrap; static PyObject *__pyx_n_s__data; @@ -793,7 +797,7 @@ static PyObject *__pyx_n_s__weight_label; static PyObject *__pyx_int_1; static PyObject *__pyx_int_15; -/* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":44 +/* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":51 * * * def train_wrap ( np.ndarray[np.float64_t, ndim=2, mode='c'] X, # <<<<<<<<<<<<<< @@ -883,54 +887,54 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solver_type); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps); if (likely(values[3])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bias); if (likely(values[4])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); if (likely(values[5])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_label); if (likely(values[6])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight); if (likely(values[7])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "train_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "train_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_X = ((PyArrayObject *)values[0]); __pyx_v_Y = ((PyArrayObject *)values[1]); - __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_bias = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_bias = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_weight_label = ((PyArrayObject *)values[6]); __pyx_v_weight = ((PyArrayObject *)values[7]); } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { @@ -938,16 +942,16 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject } else { __pyx_v_X = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); __pyx_v_Y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_solver_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_bias = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_solver_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_bias = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_weight_label = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); __pyx_v_weight = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_liblinear.train_wrap"); return NULL; @@ -964,36 +968,36 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject __pyx_bstruct_Y.buf = NULL; __pyx_bstruct_weight_label.buf = NULL; __pyx_bstruct_weight.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight_label), __pyx_ptype_5numpy_ndarray, 1, "weight_label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight), __pyx_ptype_5numpy_ndarray, 1, "weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight_label), __pyx_ptype_5numpy_ndarray, 1, "weight_label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight), __pyx_ptype_5numpy_ndarray, 1, "weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_X = __pyx_bstruct_X.strides[0]; __pyx_bstride_1_X = __pyx_bstruct_X.strides[1]; __pyx_bshape_0_X = __pyx_bstruct_X.shape[0]; __pyx_bshape_1_X = __pyx_bstruct_X.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_Y, (PyObject*)__pyx_v_Y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_Y, (PyObject*)__pyx_v_Y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_Y = __pyx_bstruct_Y.strides[0]; __pyx_bshape_0_Y = __pyx_bstruct_Y.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight_label, (PyObject*)__pyx_v_weight_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight_label, (PyObject*)__pyx_v_weight_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_weight_label = __pyx_bstruct_weight_label.strides[0]; __pyx_bshape_0_weight_label = __pyx_bstruct_weight_label.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight, (PyObject*)__pyx_v_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight, (PyObject*)__pyx_v_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_weight = __pyx_bstruct_weight.strides[0]; __pyx_bshape_0_weight = __pyx_bstruct_weight.shape[0]; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":58 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":65 * cdef int len_w * * problem = set_problem(X.data, Y.data, X.shape, bias) # <<<<<<<<<<<<<< @@ -1002,7 +1006,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject */ __pyx_v_problem = set_problem(__pyx_v_X->data, __pyx_v_Y->data, __pyx_v_X->dimensions, __pyx_v_bias); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":60 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":67 * problem = set_problem(X.data, Y.data, X.shape, bias) * * param = set_parameter(solver_type, eps, C, weight.shape[0], weight_label.data, weight.data) # <<<<<<<<<<<<<< @@ -1011,7 +1015,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject */ __pyx_v_param = set_parameter(__pyx_v_solver_type, __pyx_v_eps, __pyx_v_C, (__pyx_v_weight->dimensions[0]), __pyx_v_weight_label->data, __pyx_v_weight->data); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":62 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":69 * param = set_parameter(solver_type, eps, C, weight.shape[0], weight_label.data, weight.data) * * error_msg = check_parameter(problem, param) # <<<<<<<<<<<<<< @@ -1020,7 +1024,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject */ __pyx_v_error_msg = check_parameter(__pyx_v_problem, __pyx_v_param); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":63 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":70 * * error_msg = check_parameter(problem, param) * if error_msg: # <<<<<<<<<<<<<< @@ -1030,7 +1034,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject __pyx_t_1 = (__pyx_v_error_msg != 0); if (__pyx_t_1) { - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":64 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":71 * error_msg = check_parameter(problem, param) * if error_msg: * free_problem(problem) # <<<<<<<<<<<<<< @@ -1039,7 +1043,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject */ free_problem(__pyx_v_problem); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":65 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":72 * if error_msg: * free_problem(problem) * free_parameter(param) # <<<<<<<<<<<<<< @@ -1048,31 +1052,31 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject */ free_parameter(__pyx_v_param); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":66 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":73 * free_problem(problem) * free_parameter(param) * raise ValueError(error_msg) # <<<<<<<<<<<<<< * * # early return */ - __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":69 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":76 * * # early return * model = train(problem, param) # <<<<<<<<<<<<<< @@ -1081,7 +1085,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject */ __pyx_v_model = train(__pyx_v_problem, __pyx_v_param); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":72 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":79 * * cdef np.ndarray[np.float64_t, ndim=2, mode='c'] w * cdef int nr_class = get_nr_class(model) # <<<<<<<<<<<<<< @@ -1090,7 +1094,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject */ __pyx_v_nr_class = get_nr_class(__pyx_v_model); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":73 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":80 * cdef np.ndarray[np.float64_t, ndim=2, mode='c'] w * cdef int nr_class = get_nr_class(model) * cdef int nr_feature = get_nr_feature(model) # <<<<<<<<<<<<<< @@ -1099,7 +1103,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject */ __pyx_v_nr_feature = get_nr_feature(__pyx_v_model); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":74 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":81 * cdef int nr_class = get_nr_class(model) * cdef int nr_feature = get_nr_feature(model) * if bias > 0: nr_feature = nr_feature + 1 # <<<<<<<<<<<<<< @@ -1113,7 +1117,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject } __pyx_L7:; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":75 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":82 * cdef int nr_feature = get_nr_feature(model) * if bias > 0: nr_feature = nr_feature + 1 * if nr_class == 2: # <<<<<<<<<<<<<< @@ -1123,21 +1127,21 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject __pyx_t_1 = (__pyx_v_nr_class == 2); if (__pyx_t_1) { - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":76 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":83 * if bias > 0: nr_feature = nr_feature + 1 * if nr_class == 2: * w = np.empty((1, nr_feature)) # <<<<<<<<<<<<<< * copy_w(w.data, model, nr_feature) * else: */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_1); @@ -1145,16 +1149,16 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -1171,14 +1175,14 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject } __pyx_bstride_0_w = __pyx_bstruct_w.strides[0]; __pyx_bstride_1_w = __pyx_bstruct_w.strides[1]; __pyx_bshape_0_w = __pyx_bstruct_w.shape[0]; __pyx_bshape_1_w = __pyx_bstruct_w.shape[1]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_w)); __pyx_v_w = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":77 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":84 * if nr_class == 2: * w = np.empty((1, nr_feature)) * copy_w(w.data, model, nr_feature) # <<<<<<<<<<<<<< @@ -1190,7 +1194,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject } /*else*/ { - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":79 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":86 * copy_w(w.data, model, nr_feature) * else: * len_w = (nr_class) * nr_feature # <<<<<<<<<<<<<< @@ -1199,23 +1203,23 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject */ __pyx_v_len_w = (__pyx_v_nr_class * __pyx_v_nr_feature); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":80 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":87 * else: * len_w = (nr_class) * nr_feature * w = np.empty((nr_class, nr_feature)) # <<<<<<<<<<<<<< * copy_w(w.data, model, len_w) * */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); @@ -1223,16 +1227,16 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_10); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -1249,14 +1253,14 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject } __pyx_bstride_0_w = __pyx_bstruct_w.strides[0]; __pyx_bstride_1_w = __pyx_bstruct_w.strides[1]; __pyx_bshape_0_w = __pyx_bstruct_w.shape[0]; __pyx_bshape_1_w = __pyx_bstruct_w.shape[1]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_w)); __pyx_v_w = ((PyArrayObject *)__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":81 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":88 * len_w = (nr_class) * nr_feature * w = np.empty((nr_class, nr_feature)) * copy_w(w.data, model, len_w) # <<<<<<<<<<<<<< @@ -1267,40 +1271,40 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject } __pyx_L8:; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":84 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":91 * * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] label * label = np.empty(nr_class, dtype=np.int32) # <<<<<<<<<<<<<< * copy_label(label.data, model, nr_class) * */ - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_11); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -1317,14 +1321,14 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject } __pyx_bstride_0_label = __pyx_bstruct_label.strides[0]; __pyx_bshape_0_label = __pyx_bstruct_label.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_label)); __pyx_v_label = ((PyArrayObject *)__pyx_t_11); __pyx_t_11 = 0; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":85 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":92 * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] label * label = np.empty(nr_class, dtype=np.int32) * copy_label(label.data, model, nr_class) # <<<<<<<<<<<<<< @@ -1333,26 +1337,26 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject */ copy_label(__pyx_v_label->data, __pyx_v_model, __pyx_v_nr_class); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":88 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":95 * * ### FREE - * destroy_model(model) # <<<<<<<<<<<<<< + * free_and_destroy_model(&model) # <<<<<<<<<<<<<< * free_problem(problem) * free_parameter(param) */ - destroy_model(__pyx_v_model); + free_and_destroy_model((&__pyx_v_model)); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":89 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":96 * ### FREE - * destroy_model(model) + * free_and_destroy_model(&model) * free_problem(problem) # <<<<<<<<<<<<<< * free_parameter(param) * # destroy_param(param) don't call this or it will destroy weight_label and weight */ free_problem(__pyx_v_problem); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":90 - * destroy_model(model) + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":97 + * free_and_destroy_model(&model) * free_problem(problem) * free_parameter(param) # <<<<<<<<<<<<<< * # destroy_param(param) don't call this or it will destroy weight_label and weight @@ -1360,7 +1364,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject */ free_parameter(__pyx_v_param); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":93 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":100 * # destroy_param(param) don't call this or it will destroy weight_label and weight * * return w, label # <<<<<<<<<<<<<< @@ -1368,7 +1372,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject * def csr_train_wrap ( int n_features, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_w)); @@ -1419,7 +1423,7 @@ static PyObject *__pyx_pf_10_liblinear_train_wrap(PyObject *__pyx_self, PyObject return __pyx_r; } -/* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":95 +/* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":102 * return w, label * * def csr_train_wrap ( int n_features, # <<<<<<<<<<<<<< @@ -1519,95 +1523,95 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_values); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_indices); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_indptr); if (likely(values[3])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); if (likely(values[4])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solver_type); if (likely(values[5])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps); if (likely(values[6])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bias); if (likely(values[7])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); if (likely(values[8])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_label); if (likely(values[9])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 10: values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight); if (likely(values[10])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "csr_train_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "csr_train_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - __pyx_v_n_features = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_features = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X_values = ((PyArrayObject *)values[1]); __pyx_v_X_indices = ((PyArrayObject *)values[2]); __pyx_v_X_indptr = ((PyArrayObject *)values[3]); __pyx_v_Y = ((PyArrayObject *)values[4]); - __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_bias = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_bias = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_weight_label = ((PyArrayObject *)values[9]); __pyx_v_weight = ((PyArrayObject *)values[10]); } else if (PyTuple_GET_SIZE(__pyx_args) != 11) { goto __pyx_L5_argtuple_error; } else { - __pyx_v_n_features = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_features = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); __pyx_v_X_indices = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); __pyx_v_X_indptr = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); __pyx_v_Y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_solver_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_bias = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_solver_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_bias = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_weight_label = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 9)); __pyx_v_weight = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 10)); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_liblinear.csr_train_wrap"); return NULL; @@ -1628,50 +1632,50 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb __pyx_bstruct_Y.buf = NULL; __pyx_bstruct_weight_label.buf = NULL; __pyx_bstruct_weight.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_values), __pyx_ptype_5numpy_ndarray, 1, "X_values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indices), __pyx_ptype_5numpy_ndarray, 1, "X_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indptr), __pyx_ptype_5numpy_ndarray, 1, "X_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight_label), __pyx_ptype_5numpy_ndarray, 1, "weight_label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight), __pyx_ptype_5numpy_ndarray, 1, "weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_values), __pyx_ptype_5numpy_ndarray, 1, "X_values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indices), __pyx_ptype_5numpy_ndarray, 1, "X_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indptr), __pyx_ptype_5numpy_ndarray, 1, "X_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight_label), __pyx_ptype_5numpy_ndarray, 1, "weight_label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight), __pyx_ptype_5numpy_ndarray, 1, "weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_values, (PyObject*)__pyx_v_X_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_values, (PyObject*)__pyx_v_X_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_X_values = __pyx_bstruct_X_values.strides[0]; __pyx_bshape_0_X_values = __pyx_bstruct_X_values.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indices, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indices, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_X_indices = __pyx_bstruct_X_indices.strides[0]; __pyx_bshape_0_X_indices = __pyx_bstruct_X_indices.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indptr, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indptr, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_X_indptr = __pyx_bstruct_X_indptr.strides[0]; __pyx_bshape_0_X_indptr = __pyx_bstruct_X_indptr.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_Y, (PyObject*)__pyx_v_Y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_Y, (PyObject*)__pyx_v_Y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_Y = __pyx_bstruct_Y.strides[0]; __pyx_bshape_0_Y = __pyx_bstruct_Y.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight_label, (PyObject*)__pyx_v_weight_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight_label, (PyObject*)__pyx_v_weight_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_weight_label = __pyx_bstruct_weight_label.strides[0]; __pyx_bshape_0_weight_label = __pyx_bstruct_weight_label.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight, (PyObject*)__pyx_v_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight, (PyObject*)__pyx_v_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_weight = __pyx_bstruct_weight.strides[0]; __pyx_bshape_0_weight = __pyx_bstruct_weight.shape[0]; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":115 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":122 * * problem = csr_set_problem(X_values.data, X_indices.shape, * X_indices.data, X_indptr.shape, X_indptr.data, Y.data, n_features, bias) # <<<<<<<<<<<<<< @@ -1680,7 +1684,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb */ __pyx_v_problem = csr_set_problem(__pyx_v_X_values->data, __pyx_v_X_indices->dimensions, __pyx_v_X_indices->data, __pyx_v_X_indptr->dimensions, __pyx_v_X_indptr->data, __pyx_v_Y->data, __pyx_v_n_features, __pyx_v_bias); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":117 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":124 * X_indices.data, X_indptr.shape, X_indptr.data, Y.data, n_features, bias) * * param = set_parameter(solver_type, eps, C, weight.shape[0], weight_label.data, weight.data) # <<<<<<<<<<<<<< @@ -1689,7 +1693,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb */ __pyx_v_param = set_parameter(__pyx_v_solver_type, __pyx_v_eps, __pyx_v_C, (__pyx_v_weight->dimensions[0]), __pyx_v_weight_label->data, __pyx_v_weight->data); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":119 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":126 * param = set_parameter(solver_type, eps, C, weight.shape[0], weight_label.data, weight.data) * * error_msg = check_parameter(problem, param) # <<<<<<<<<<<<<< @@ -1698,7 +1702,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb */ __pyx_v_error_msg = check_parameter(__pyx_v_problem, __pyx_v_param); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":120 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":127 * * error_msg = check_parameter(problem, param) * if error_msg: # <<<<<<<<<<<<<< @@ -1708,7 +1712,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb __pyx_t_1 = (__pyx_v_error_msg != 0); if (__pyx_t_1) { - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":121 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":128 * error_msg = check_parameter(problem, param) * if error_msg: * free_problem(problem) # <<<<<<<<<<<<<< @@ -1717,7 +1721,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb */ free_problem(__pyx_v_problem); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":122 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":129 * if error_msg: * free_problem(problem) * free_parameter(param) # <<<<<<<<<<<<<< @@ -1726,31 +1730,31 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb */ free_parameter(__pyx_v_param); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":123 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":130 * free_problem(problem) * free_parameter(param) * raise ValueError(error_msg) # <<<<<<<<<<<<<< * * # early return */ - __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":126 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":133 * * # early return * model = train(problem, param) # <<<<<<<<<<<<<< @@ -1759,7 +1763,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb */ __pyx_v_model = train(__pyx_v_problem, __pyx_v_param); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":129 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":136 * * cdef np.ndarray[np.float64_t, ndim=2, mode='c'] w * cdef int nr_class = get_nr_class(model) # <<<<<<<<<<<<<< @@ -1768,7 +1772,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb */ __pyx_v_nr_class = get_nr_class(__pyx_v_model); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":130 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":137 * cdef np.ndarray[np.float64_t, ndim=2, mode='c'] w * cdef int nr_class = get_nr_class(model) * cdef int nr_feature = n_features # <<<<<<<<<<<<<< @@ -1777,7 +1781,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb */ __pyx_v_nr_feature = __pyx_v_n_features; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":131 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":138 * cdef int nr_class = get_nr_class(model) * cdef int nr_feature = n_features * if bias > 0: nr_feature = nr_feature + 1 # <<<<<<<<<<<<<< @@ -1791,7 +1795,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb } __pyx_L7:; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":132 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":139 * cdef int nr_feature = n_features * if bias > 0: nr_feature = nr_feature + 1 * if nr_class == 2: # <<<<<<<<<<<<<< @@ -1801,21 +1805,21 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb __pyx_t_1 = (__pyx_v_nr_class == 2); if (__pyx_t_1) { - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":133 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":140 * if bias > 0: nr_feature = nr_feature + 1 * if nr_class == 2: * w = np.empty((1, nr_feature)) # <<<<<<<<<<<<<< * copy_w(w.data, model, nr_feature) * else: */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_1); @@ -1823,16 +1827,16 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -1849,14 +1853,14 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb } __pyx_bstride_0_w = __pyx_bstruct_w.strides[0]; __pyx_bstride_1_w = __pyx_bstruct_w.strides[1]; __pyx_bshape_0_w = __pyx_bstruct_w.shape[0]; __pyx_bshape_1_w = __pyx_bstruct_w.shape[1]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_w)); __pyx_v_w = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":134 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":141 * if nr_class == 2: * w = np.empty((1, nr_feature)) * copy_w(w.data, model, nr_feature) # <<<<<<<<<<<<<< @@ -1868,7 +1872,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb } /*else*/ { - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":136 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":143 * copy_w(w.data, model, nr_feature) * else: * len_w = (nr_class * nr_feature) # <<<<<<<<<<<<<< @@ -1877,23 +1881,23 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb */ __pyx_v_len_w = (__pyx_v_nr_class * __pyx_v_nr_feature); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":137 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":144 * else: * len_w = (nr_class * nr_feature) * w = np.empty((nr_class, nr_feature)) # <<<<<<<<<<<<<< * copy_w(w.data, model, len_w) * */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); @@ -1901,16 +1905,16 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_10); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -1927,14 +1931,14 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb } __pyx_bstride_0_w = __pyx_bstruct_w.strides[0]; __pyx_bstride_1_w = __pyx_bstruct_w.strides[1]; __pyx_bshape_0_w = __pyx_bstruct_w.shape[0]; __pyx_bshape_1_w = __pyx_bstruct_w.shape[1]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_w)); __pyx_v_w = ((PyArrayObject *)__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":138 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":145 * len_w = (nr_class * nr_feature) * w = np.empty((nr_class, nr_feature)) * copy_w(w.data, model, len_w) # <<<<<<<<<<<<<< @@ -1945,40 +1949,40 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb } __pyx_L8:; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":141 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":148 * * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] label * label = np.empty((nr_class), dtype=np.int32) # <<<<<<<<<<<<<< * copy_label(label.data, model, nr_class) * */ - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_11); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -1995,14 +1999,14 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb } __pyx_bstride_0_label = __pyx_bstruct_label.strides[0]; __pyx_bshape_0_label = __pyx_bstruct_label.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_label)); __pyx_v_label = ((PyArrayObject *)__pyx_t_11); __pyx_t_11 = 0; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":142 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":149 * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] label * label = np.empty((nr_class), dtype=np.int32) * copy_label(label.data, model, nr_class) # <<<<<<<<<<<<<< @@ -2011,26 +2015,26 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb */ copy_label(__pyx_v_label->data, __pyx_v_model, __pyx_v_nr_class); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":145 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":152 * * ### FREE - * destroy_model(model) # <<<<<<<<<<<<<< + * free_and_destroy_model(&model) # <<<<<<<<<<<<<< * free_problem(problem) * free_parameter(param) */ - destroy_model(__pyx_v_model); + free_and_destroy_model((&__pyx_v_model)); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":146 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":153 * ### FREE - * destroy_model(model) + * free_and_destroy_model(&model) * free_problem(problem) # <<<<<<<<<<<<<< * free_parameter(param) * # destroy_param(param) don't call this or it will destroy weight_label and weight */ free_problem(__pyx_v_problem); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":147 - * destroy_model(model) + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":154 + * free_and_destroy_model(&model) * free_problem(problem) * free_parameter(param) # <<<<<<<<<<<<<< * # destroy_param(param) don't call this or it will destroy weight_label and weight @@ -2038,7 +2042,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb */ free_parameter(__pyx_v_param); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":150 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":157 * # destroy_param(param) don't call this or it will destroy weight_label and weight * * return w, label # <<<<<<<<<<<<<< @@ -2046,7 +2050,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb * def predict_wrap(np.ndarray[np.float64_t, ndim=2, mode='c'] T, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_w)); @@ -2103,7 +2107,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_train_wrap(PyObject *__pyx_self, PyOb return __pyx_r; } -/* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":152 +/* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":159 * return w, label * * def predict_wrap(np.ndarray[np.float64_t, ndim=2, mode='c'] T, # <<<<<<<<<<<<<< @@ -2187,79 +2191,79 @@ static PyObject *__pyx_pf_10_liblinear_predict_wrap(PyObject *__pyx_self, PyObje values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coef_); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solver_type); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps); if (likely(values[3])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); if (likely(values[4])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_label); if (likely(values[5])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight); if (likely(values[6])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label); if (likely(values[7])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bias); if (likely(values[8])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "predict_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "predict_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_T = ((PyArrayObject *)values[0]); __pyx_v_coef_ = ((PyArrayObject *)values[1]); - __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_weight_label = ((PyArrayObject *)values[5]); __pyx_v_weight = ((PyArrayObject *)values[6]); __pyx_v_label = ((PyArrayObject *)values[7]); - __pyx_v_bias = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_bias = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { goto __pyx_L5_argtuple_error; } else { __pyx_v_T = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); __pyx_v_coef_ = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_solver_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_solver_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_weight_label = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); __pyx_v_weight = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); __pyx_v_label = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); - __pyx_v_bias = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_bias = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_wrap", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_liblinear.predict_wrap"); return NULL; @@ -2276,43 +2280,43 @@ static PyObject *__pyx_pf_10_liblinear_predict_wrap(PyObject *__pyx_self, PyObje __pyx_bstruct_weight_label.buf = NULL; __pyx_bstruct_weight.buf = NULL; __pyx_bstruct_label.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T), __pyx_ptype_5numpy_ndarray, 1, "T", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coef_), __pyx_ptype_5numpy_ndarray, 1, "coef_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight_label), __pyx_ptype_5numpy_ndarray, 1, "weight_label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight), __pyx_ptype_5numpy_ndarray, 1, "weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T), __pyx_ptype_5numpy_ndarray, 1, "T", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coef_), __pyx_ptype_5numpy_ndarray, 1, "coef_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight_label), __pyx_ptype_5numpy_ndarray, 1, "weight_label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight), __pyx_ptype_5numpy_ndarray, 1, "weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T, (PyObject*)__pyx_v_T, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T, (PyObject*)__pyx_v_T, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_T = __pyx_bstruct_T.strides[0]; __pyx_bstride_1_T = __pyx_bstruct_T.strides[1]; __pyx_bshape_0_T = __pyx_bstruct_T.shape[0]; __pyx_bshape_1_T = __pyx_bstruct_T.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_coef_, (PyObject*)__pyx_v_coef_, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_coef_, (PyObject*)__pyx_v_coef_, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_coef_ = __pyx_bstruct_coef_.strides[0]; __pyx_bstride_1_coef_ = __pyx_bstruct_coef_.strides[1]; __pyx_bshape_0_coef_ = __pyx_bstruct_coef_.shape[0]; __pyx_bshape_1_coef_ = __pyx_bstruct_coef_.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight_label, (PyObject*)__pyx_v_weight_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight_label, (PyObject*)__pyx_v_weight_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_weight_label = __pyx_bstruct_weight_label.strides[0]; __pyx_bshape_0_weight_label = __pyx_bstruct_weight_label.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight, (PyObject*)__pyx_v_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight, (PyObject*)__pyx_v_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_weight = __pyx_bstruct_weight.strides[0]; __pyx_bshape_0_weight = __pyx_bstruct_weight.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_label, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_label, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_label = __pyx_bstruct_label.strides[0]; __pyx_bshape_0_label = __pyx_bstruct_label.shape[0]; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":164 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":171 * cdef model *model * * param = set_parameter(solver_type, eps, C, weight.shape[0], weight_label.data, weight.data) # <<<<<<<<<<<<<< @@ -2321,7 +2325,7 @@ static PyObject *__pyx_pf_10_liblinear_predict_wrap(PyObject *__pyx_self, PyObje */ __pyx_v_param = set_parameter(__pyx_v_solver_type, __pyx_v_eps, __pyx_v_C, (__pyx_v_weight->dimensions[0]), __pyx_v_weight_label->data, __pyx_v_weight->data); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":166 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":173 * param = set_parameter(solver_type, eps, C, weight.shape[0], weight_label.data, weight.data) * * model = set_model(param, coef_.data, coef_.shape, label.data, bias) # <<<<<<<<<<<<<< @@ -2330,40 +2334,40 @@ static PyObject *__pyx_pf_10_liblinear_predict_wrap(PyObject *__pyx_self, PyObje */ __pyx_v_model = set_model(__pyx_v_param, __pyx_v_coef_->data, __pyx_v_coef_->dimensions, __pyx_v_label->data, __pyx_v_bias); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":168 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":175 * model = set_model(param, coef_.data, coef_.shape, label.data, bias) * * dec_values = np.empty(T.shape[0], dtype=np.int32) # <<<<<<<<<<<<<< * if copy_predict(T.data, model, T.shape, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_T->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_T->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2380,14 +2384,14 @@ static PyObject *__pyx_pf_10_liblinear_predict_wrap(PyObject *__pyx_self, PyObje } __pyx_bstride_0_dec_values = __pyx_bstruct_dec_values.strides[0]; __pyx_bshape_0_dec_values = __pyx_bstruct_dec_values.shape[0]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_dec_values)); __pyx_v_dec_values = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":169 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":176 * * dec_values = np.empty(T.shape[0], dtype=np.int32) * if copy_predict(T.data, model, T.shape, dec_values.data) < 0: # <<<<<<<<<<<<<< @@ -2397,49 +2401,49 @@ static PyObject *__pyx_pf_10_liblinear_predict_wrap(PyObject *__pyx_self, PyObje __pyx_t_11 = (copy_predict(__pyx_v_T->data, __pyx_v_model, __pyx_v_T->dimensions, __pyx_v_dec_values->data) < 0); if (__pyx_t_11) { - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":170 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":177 * dec_values = np.empty(T.shape[0], dtype=np.int32) * if copy_predict(T.data, model, T.shape, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * * ### FREE */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); - __pyx_t_1 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_1, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":173 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":180 * * ### FREE * free_parameter(param) # <<<<<<<<<<<<<< - * destroy_model(model) + * free_and_destroy_model(&model) * return dec_values */ free_parameter(__pyx_v_param); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":174 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":181 * ### FREE * free_parameter(param) - * destroy_model(model) # <<<<<<<<<<<<<< + * free_and_destroy_model(&model) # <<<<<<<<<<<<<< * return dec_values * */ - destroy_model(__pyx_v_model); + free_and_destroy_model((&__pyx_v_model)); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":175 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":182 * free_parameter(param) - * destroy_model(model) + * free_and_destroy_model(&model) * return dec_values # <<<<<<<<<<<<<< * * @@ -2488,7 +2492,7 @@ static PyObject *__pyx_pf_10_liblinear_predict_wrap(PyObject *__pyx_self, PyObje return __pyx_r; } -/* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":178 +/* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":185 * * * def csr_predict_wrap( # <<<<<<<<<<<<<< @@ -2526,9 +2530,6 @@ static PyObject *__pyx_pf_10_liblinear_csr_predict_wrap(PyObject *__pyx_self, Py Py_buffer __pyx_bstruct_T_values; Py_ssize_t __pyx_bstride_0_T_values = 0; Py_ssize_t __pyx_bshape_0_T_values = 0; - Py_buffer __pyx_bstruct_dec_values; - Py_ssize_t __pyx_bstride_0_dec_values = 0; - Py_ssize_t __pyx_bshape_0_dec_values = 0; Py_buffer __pyx_bstruct_coef_; Py_ssize_t __pyx_bstride_0_coef_ = 0; Py_ssize_t __pyx_bstride_1_coef_ = 0; @@ -2537,6 +2538,9 @@ static PyObject *__pyx_pf_10_liblinear_csr_predict_wrap(PyObject *__pyx_self, Py Py_buffer __pyx_bstruct_T_indptr; Py_ssize_t __pyx_bstride_0_T_indptr = 0; Py_ssize_t __pyx_bshape_0_T_indptr = 0; + Py_buffer __pyx_bstruct_dec_values; + Py_ssize_t __pyx_bstride_0_dec_values = 0; + Py_ssize_t __pyx_bshape_0_dec_values = 0; Py_buffer __pyx_bstruct_label; Py_ssize_t __pyx_bstride_0_label = 0; Py_ssize_t __pyx_bshape_0_label = 0; @@ -2583,103 +2587,103 @@ static PyObject *__pyx_pf_10_liblinear_csr_predict_wrap(PyObject *__pyx_self, Py values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T_values); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T_indices); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T_indptr); if (likely(values[3])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coef_); if (likely(values[4])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solver_type); if (likely(values[5])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps); if (likely(values[6])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); if (likely(values[7])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_label); if (likely(values[8])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight); if (likely(values[9])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 10: values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label); if (likely(values[10])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 11: values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bias); if (likely(values[11])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "csr_predict_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "csr_predict_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - __pyx_v_n_features = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_features = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_T_values = ((PyArrayObject *)values[1]); __pyx_v_T_indices = ((PyArrayObject *)values[2]); __pyx_v_T_indptr = ((PyArrayObject *)values[3]); __pyx_v_coef_ = ((PyArrayObject *)values[4]); - __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_weight_label = ((PyArrayObject *)values[8]); __pyx_v_weight = ((PyArrayObject *)values[9]); __pyx_v_label = ((PyArrayObject *)values[10]); - __pyx_v_bias = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_bias = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else if (PyTuple_GET_SIZE(__pyx_args) != 12) { goto __pyx_L5_argtuple_error; } else { - __pyx_v_n_features = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_features = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_T_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); __pyx_v_T_indices = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); __pyx_v_T_indptr = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); __pyx_v_coef_ = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - __pyx_v_solver_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_solver_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_weight_label = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 8)); __pyx_v_weight = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 9)); __pyx_v_label = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 10)); - __pyx_v_bias = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 11)); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_bias = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 11)); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_predict_wrap", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_liblinear.csr_predict_wrap"); return NULL; @@ -2700,57 +2704,57 @@ static PyObject *__pyx_pf_10_liblinear_csr_predict_wrap(PyObject *__pyx_self, Py __pyx_bstruct_weight_label.buf = NULL; __pyx_bstruct_weight.buf = NULL; __pyx_bstruct_label.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_values), __pyx_ptype_5numpy_ndarray, 1, "T_values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indices), __pyx_ptype_5numpy_ndarray, 1, "T_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indptr), __pyx_ptype_5numpy_ndarray, 1, "T_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coef_), __pyx_ptype_5numpy_ndarray, 1, "coef_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight_label), __pyx_ptype_5numpy_ndarray, 1, "weight_label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight), __pyx_ptype_5numpy_ndarray, 1, "weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_values), __pyx_ptype_5numpy_ndarray, 1, "T_values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indices), __pyx_ptype_5numpy_ndarray, 1, "T_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indptr), __pyx_ptype_5numpy_ndarray, 1, "T_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coef_), __pyx_ptype_5numpy_ndarray, 1, "coef_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight_label), __pyx_ptype_5numpy_ndarray, 1, "weight_label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight), __pyx_ptype_5numpy_ndarray, 1, "weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T_values, (PyObject*)__pyx_v_T_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T_values, (PyObject*)__pyx_v_T_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_T_values = __pyx_bstruct_T_values.strides[0]; __pyx_bshape_0_T_values = __pyx_bstruct_T_values.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T_indices, (PyObject*)__pyx_v_T_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T_indices, (PyObject*)__pyx_v_T_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_T_indices = __pyx_bstruct_T_indices.strides[0]; __pyx_bshape_0_T_indices = __pyx_bstruct_T_indices.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T_indptr, (PyObject*)__pyx_v_T_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T_indptr, (PyObject*)__pyx_v_T_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_T_indptr = __pyx_bstruct_T_indptr.strides[0]; __pyx_bshape_0_T_indptr = __pyx_bstruct_T_indptr.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_coef_, (PyObject*)__pyx_v_coef_, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_coef_, (PyObject*)__pyx_v_coef_, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_coef_ = __pyx_bstruct_coef_.strides[0]; __pyx_bstride_1_coef_ = __pyx_bstruct_coef_.strides[1]; __pyx_bshape_0_coef_ = __pyx_bstruct_coef_.shape[0]; __pyx_bshape_1_coef_ = __pyx_bstruct_coef_.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight_label, (PyObject*)__pyx_v_weight_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight_label, (PyObject*)__pyx_v_weight_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_weight_label = __pyx_bstruct_weight_label.strides[0]; __pyx_bshape_0_weight_label = __pyx_bstruct_weight_label.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight, (PyObject*)__pyx_v_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight, (PyObject*)__pyx_v_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_weight = __pyx_bstruct_weight.strides[0]; __pyx_bshape_0_weight = __pyx_bstruct_weight.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_label, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_label, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_label = __pyx_bstruct_label.strides[0]; __pyx_bshape_0_label = __pyx_bstruct_label.shape[0]; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":199 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":206 * cdef model *model * * param = set_parameter(solver_type, eps, C, weight.shape[0], weight_label.data, weight.data) # <<<<<<<<<<<<<< @@ -2759,7 +2763,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_predict_wrap(PyObject *__pyx_self, Py */ __pyx_v_param = set_parameter(__pyx_v_solver_type, __pyx_v_eps, __pyx_v_C, (__pyx_v_weight->dimensions[0]), __pyx_v_weight_label->data, __pyx_v_weight->data); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":201 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":208 * param = set_parameter(solver_type, eps, C, weight.shape[0], weight_label.data, weight.data) * * model = set_model(param, coef_.data, coef_.shape, label.data, bias) # <<<<<<<<<<<<<< @@ -2768,40 +2772,40 @@ static PyObject *__pyx_pf_10_liblinear_csr_predict_wrap(PyObject *__pyx_self, Py */ __pyx_v_model = set_model(__pyx_v_param, __pyx_v_coef_->data, __pyx_v_coef_->dimensions, __pyx_v_label->data, __pyx_v_bias); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":203 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":210 * model = set_model(param, coef_.data, coef_.shape, label.data, bias) * * dec_values = np.empty(T_indptr.shape[0] - 1, dtype=np.int32) # <<<<<<<<<<<<<< * if csr_copy_predict(n_features, T_values.shape, T_values.data, * T_indices.shape, T_indices.data, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(((__pyx_v_T_indptr->dimensions[0]) - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(((__pyx_v_T_indptr->dimensions[0]) - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2818,14 +2822,14 @@ static PyObject *__pyx_pf_10_liblinear_csr_predict_wrap(PyObject *__pyx_self, Py } __pyx_bstride_0_dec_values = __pyx_bstruct_dec_values.strides[0]; __pyx_bshape_0_dec_values = __pyx_bstruct_dec_values.shape[0]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_dec_values)); __pyx_v_dec_values = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":207 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":214 * T_indices.shape, T_indices.data, * T_indptr.shape, T_indptr.data, * model, dec_values.data) < 0: # <<<<<<<<<<<<<< @@ -2835,49 +2839,49 @@ static PyObject *__pyx_pf_10_liblinear_csr_predict_wrap(PyObject *__pyx_self, Py __pyx_t_11 = (csr_copy_predict(__pyx_v_n_features, __pyx_v_T_values->dimensions, __pyx_v_T_values->data, __pyx_v_T_indices->dimensions, __pyx_v_T_indices->data, __pyx_v_T_indptr->dimensions, __pyx_v_T_indptr->data, __pyx_v_model, __pyx_v_dec_values->data) < 0); if (__pyx_t_11) { - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":208 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":215 * T_indptr.shape, T_indptr.data, * model, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * * ### FREE */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); - __pyx_t_1 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_1, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":211 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":218 * * ### FREE * free_parameter(param) # <<<<<<<<<<<<<< - * destroy_model(model) + * free_and_destroy_model(&model) * return dec_values */ free_parameter(__pyx_v_param); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":212 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":219 * ### FREE * free_parameter(param) - * destroy_model(model) # <<<<<<<<<<<<<< + * free_and_destroy_model(&model) # <<<<<<<<<<<<<< * return dec_values * */ - destroy_model(__pyx_v_model); + free_and_destroy_model((&__pyx_v_model)); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":213 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":220 * free_parameter(param) - * destroy_model(model) + * free_and_destroy_model(&model) * return dec_values # <<<<<<<<<<<<<< * * @@ -2901,9 +2905,9 @@ static PyObject *__pyx_pf_10_liblinear_csr_predict_wrap(PyObject *__pyx_self, Py __Pyx_SafeReleaseBuffer(&__pyx_bstruct_weight); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_indices); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dec_values); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coef_); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_indptr); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dec_values); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_label); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("_liblinear.csr_predict_wrap"); @@ -2914,9 +2918,9 @@ static PyObject *__pyx_pf_10_liblinear_csr_predict_wrap(PyObject *__pyx_self, Py __Pyx_SafeReleaseBuffer(&__pyx_bstruct_weight); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_indices); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_values); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dec_values); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coef_); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_indptr); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dec_values); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_label); __pyx_L2:; __Pyx_DECREF((PyObject *)__pyx_v_dec_values); @@ -2932,7 +2936,7 @@ static PyObject *__pyx_pf_10_liblinear_csr_predict_wrap(PyObject *__pyx_self, Py return __pyx_r; } -/* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":218 +/* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":225 * * * def predict_prob_wrap(np.ndarray[np.float64_t, ndim=2, mode='c'] T, # <<<<<<<<<<<<<< @@ -3020,79 +3024,79 @@ static PyObject *__pyx_pf_10_liblinear_predict_prob_wrap(PyObject *__pyx_self, P values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coef_); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solver_type); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps); if (likely(values[3])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); if (likely(values[4])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_label); if (likely(values[5])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight); if (likely(values[6])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label); if (likely(values[7])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bias); if (likely(values[8])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "predict_prob_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "predict_prob_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_T = ((PyArrayObject *)values[0]); __pyx_v_coef_ = ((PyArrayObject *)values[1]); - __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_weight_label = ((PyArrayObject *)values[5]); __pyx_v_weight = ((PyArrayObject *)values[6]); __pyx_v_label = ((PyArrayObject *)values[7]); - __pyx_v_bias = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_bias = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { goto __pyx_L5_argtuple_error; } else { __pyx_v_T = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); __pyx_v_coef_ = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_solver_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_solver_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_weight_label = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); __pyx_v_weight = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); __pyx_v_label = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 7)); - __pyx_v_bias = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_bias = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_prob_wrap", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("_liblinear.predict_prob_wrap"); return NULL; @@ -3109,43 +3113,43 @@ static PyObject *__pyx_pf_10_liblinear_predict_prob_wrap(PyObject *__pyx_self, P __pyx_bstruct_weight_label.buf = NULL; __pyx_bstruct_weight.buf = NULL; __pyx_bstruct_label.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T), __pyx_ptype_5numpy_ndarray, 1, "T", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coef_), __pyx_ptype_5numpy_ndarray, 1, "coef_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight_label), __pyx_ptype_5numpy_ndarray, 1, "weight_label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight), __pyx_ptype_5numpy_ndarray, 1, "weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T), __pyx_ptype_5numpy_ndarray, 1, "T", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coef_), __pyx_ptype_5numpy_ndarray, 1, "coef_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight_label), __pyx_ptype_5numpy_ndarray, 1, "weight_label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight), __pyx_ptype_5numpy_ndarray, 1, "weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T, (PyObject*)__pyx_v_T, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T, (PyObject*)__pyx_v_T, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_T = __pyx_bstruct_T.strides[0]; __pyx_bstride_1_T = __pyx_bstruct_T.strides[1]; __pyx_bshape_0_T = __pyx_bstruct_T.shape[0]; __pyx_bshape_1_T = __pyx_bstruct_T.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_coef_, (PyObject*)__pyx_v_coef_, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_coef_, (PyObject*)__pyx_v_coef_, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_coef_ = __pyx_bstruct_coef_.strides[0]; __pyx_bstride_1_coef_ = __pyx_bstruct_coef_.strides[1]; __pyx_bshape_0_coef_ = __pyx_bstruct_coef_.shape[0]; __pyx_bshape_1_coef_ = __pyx_bstruct_coef_.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight_label, (PyObject*)__pyx_v_weight_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight_label, (PyObject*)__pyx_v_weight_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_weight_label = __pyx_bstruct_weight_label.strides[0]; __pyx_bshape_0_weight_label = __pyx_bstruct_weight_label.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight, (PyObject*)__pyx_v_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight, (PyObject*)__pyx_v_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_weight = __pyx_bstruct_weight.strides[0]; __pyx_bshape_0_weight = __pyx_bstruct_weight.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_label, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_label, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_label = __pyx_bstruct_label.strides[0]; __pyx_bshape_0_label = __pyx_bstruct_label.shape[0]; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":255 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":262 * cdef model *model * * param = set_parameter(solver_type, eps, C, weight.shape[0], weight_label.data, weight.data) # <<<<<<<<<<<<<< @@ -3154,7 +3158,7 @@ static PyObject *__pyx_pf_10_liblinear_predict_prob_wrap(PyObject *__pyx_self, P */ __pyx_v_param = set_parameter(__pyx_v_solver_type, __pyx_v_eps, __pyx_v_C, (__pyx_v_weight->dimensions[0]), __pyx_v_weight_label->data, __pyx_v_weight->data); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":257 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":264 * param = set_parameter(solver_type, eps, C, weight.shape[0], weight_label.data, weight.data) * * model = set_model(param, coef_.data, coef_.shape, label.data, bias) # <<<<<<<<<<<<<< @@ -3163,7 +3167,7 @@ static PyObject *__pyx_pf_10_liblinear_predict_prob_wrap(PyObject *__pyx_self, P */ __pyx_v_model = set_model(__pyx_v_param, __pyx_v_coef_->data, __pyx_v_coef_->dimensions, __pyx_v_label->data, __pyx_v_bias); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":259 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":266 * model = set_model(param, coef_.data, coef_.shape, label.data, bias) * * cdef int nr_class = get_nr_class(model) # <<<<<<<<<<<<<< @@ -3172,23 +3176,23 @@ static PyObject *__pyx_pf_10_liblinear_predict_prob_wrap(PyObject *__pyx_self, P */ __pyx_v_nr_class = get_nr_class(__pyx_v_model); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":260 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":267 * * cdef int nr_class = get_nr_class(model) * dec_values = np.empty((T.shape[0], nr_class), dtype=np.float64) # <<<<<<<<<<<<<< * if copy_prob_predict(T.data, model, T.shape, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_T->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_T->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -3196,26 +3200,26 @@ static PyObject *__pyx_pf_10_liblinear_predict_prob_wrap(PyObject *__pyx_self, P __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -3232,14 +3236,14 @@ static PyObject *__pyx_pf_10_liblinear_predict_prob_wrap(PyObject *__pyx_self, P } __pyx_bstride_0_dec_values = __pyx_bstruct_dec_values.strides[0]; __pyx_bstride_1_dec_values = __pyx_bstruct_dec_values.strides[1]; __pyx_bshape_0_dec_values = __pyx_bstruct_dec_values.shape[0]; __pyx_bshape_1_dec_values = __pyx_bstruct_dec_values.shape[1]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_dec_values)); __pyx_v_dec_values = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":261 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":268 * cdef int nr_class = get_nr_class(model) * dec_values = np.empty((T.shape[0], nr_class), dtype=np.float64) * if copy_prob_predict(T.data, model, T.shape, dec_values.data) < 0: # <<<<<<<<<<<<<< @@ -3249,50 +3253,52 @@ static PyObject *__pyx_pf_10_liblinear_predict_prob_wrap(PyObject *__pyx_self, P __pyx_t_11 = (copy_prob_predict(__pyx_v_T->data, __pyx_v_model, __pyx_v_T->dimensions, __pyx_v_dec_values->data) < 0); if (__pyx_t_11) { - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":262 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":269 * dec_values = np.empty((T.shape[0], nr_class), dtype=np.float64) * if copy_prob_predict(T.data, model, T.shape, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * * ### FREE */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_4, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":265 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":272 * * ### FREE * free_parameter(param) # <<<<<<<<<<<<<< - * destroy_model(model) + * free_and_destroy_model(&model) * */ free_parameter(__pyx_v_param); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":266 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":273 * ### FREE * free_parameter(param) - * destroy_model(model) # <<<<<<<<<<<<<< + * free_and_destroy_model(&model) # <<<<<<<<<<<<<< * * return dec_values */ - destroy_model(__pyx_v_model); + free_and_destroy_model((&__pyx_v_model)); - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":268 - * destroy_model(model) + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":275 + * free_and_destroy_model(&model) * * return dec_values # <<<<<<<<<<<<<< + * + * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_dec_values)); @@ -3338,7 +3344,470 @@ static PyObject *__pyx_pf_10_liblinear_predict_prob_wrap(PyObject *__pyx_self, P return __pyx_r; } -/* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 +/* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":279 + * + * + * def csr_predict_prob( # <<<<<<<<<<<<<< + * int n_features, + * np.ndarray[np.float64_t, ndim=1, mode='c'] T_values, + */ + +static PyObject *__pyx_pf_10_liblinear_csr_predict_prob(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_10_liblinear_csr_predict_prob[] = "\n Predict probability from model\n\n Test data given in CSR format\n "; +static PyObject *__pyx_pf_10_liblinear_csr_predict_prob(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_n_features; + PyArrayObject *__pyx_v_T_values = 0; + PyArrayObject *__pyx_v_T_indices = 0; + PyArrayObject *__pyx_v_T_indptr = 0; + PyArrayObject *__pyx_v_coef_ = 0; + int __pyx_v_solver_type; + double __pyx_v_eps; + double __pyx_v_C; + PyArrayObject *__pyx_v_weight_label = 0; + PyArrayObject *__pyx_v_weight = 0; + PyArrayObject *__pyx_v_label = 0; + double __pyx_v_bias; + PyArrayObject *__pyx_v_dec_values; + struct parameter *__pyx_v_param; + struct model *__pyx_v_model; + int __pyx_v_nr_class; + Py_buffer __pyx_bstruct_weight_label; + Py_ssize_t __pyx_bstride_0_weight_label = 0; + Py_ssize_t __pyx_bshape_0_weight_label = 0; + Py_buffer __pyx_bstruct_weight; + Py_ssize_t __pyx_bstride_0_weight = 0; + Py_ssize_t __pyx_bshape_0_weight = 0; + Py_buffer __pyx_bstruct_T_indices; + Py_ssize_t __pyx_bstride_0_T_indices = 0; + Py_ssize_t __pyx_bshape_0_T_indices = 0; + Py_buffer __pyx_bstruct_T_values; + Py_ssize_t __pyx_bstride_0_T_values = 0; + Py_ssize_t __pyx_bshape_0_T_values = 0; + Py_buffer __pyx_bstruct_coef_; + Py_ssize_t __pyx_bstride_0_coef_ = 0; + Py_ssize_t __pyx_bstride_1_coef_ = 0; + Py_ssize_t __pyx_bshape_0_coef_ = 0; + Py_ssize_t __pyx_bshape_1_coef_ = 0; + Py_buffer __pyx_bstruct_T_indptr; + Py_ssize_t __pyx_bstride_0_T_indptr = 0; + Py_ssize_t __pyx_bshape_0_T_indptr = 0; + Py_buffer __pyx_bstruct_dec_values; + Py_ssize_t __pyx_bstride_0_dec_values = 0; + Py_ssize_t __pyx_bstride_1_dec_values = 0; + Py_ssize_t __pyx_bshape_0_dec_values = 0; + Py_ssize_t __pyx_bshape_1_dec_values = 0; + Py_buffer __pyx_bstruct_label; + Py_ssize_t __pyx_bstride_0_label = 0; + Py_ssize_t __pyx_bshape_0_label = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_features,&__pyx_n_s__T_values,&__pyx_n_s__T_indices,&__pyx_n_s__T_indptr,&__pyx_n_s__coef_,&__pyx_n_s__solver_type,&__pyx_n_s__eps,&__pyx_n_s__C,&__pyx_n_s__weight_label,&__pyx_n_s__weight,&__pyx_n_s__label,&__pyx_n_s__bias,0}; + __Pyx_RefNannySetupContext("csr_predict_prob"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_features); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T_values); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T_indices); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T_indptr); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coef_); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solver_type); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); + if (likely(values[7])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 8: + values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_label); + if (likely(values[8])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 9: + values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight); + if (likely(values[9])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 10: + values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label); + if (likely(values[10])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 11: + values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bias); + if (likely(values[11])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "csr_predict_prob") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_n_features = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_T_values = ((PyArrayObject *)values[1]); + __pyx_v_T_indices = ((PyArrayObject *)values[2]); + __pyx_v_T_indptr = ((PyArrayObject *)values[3]); + __pyx_v_coef_ = ((PyArrayObject *)values[4]); + __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_weight_label = ((PyArrayObject *)values[8]); + __pyx_v_weight = ((PyArrayObject *)values[9]); + __pyx_v_label = ((PyArrayObject *)values[10]); + __pyx_v_bias = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 12) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_n_features = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_T_values = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); + __pyx_v_T_indices = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); + __pyx_v_T_indptr = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); + __pyx_v_coef_ = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); + __pyx_v_solver_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_weight_label = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 8)); + __pyx_v_weight = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 9)); + __pyx_v_label = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 10)); + __pyx_v_bias = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 11)); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("csr_predict_prob", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_liblinear.csr_predict_prob"); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_T_values); + __Pyx_INCREF((PyObject *)__pyx_v_T_indices); + __Pyx_INCREF((PyObject *)__pyx_v_T_indptr); + __Pyx_INCREF((PyObject *)__pyx_v_coef_); + __Pyx_INCREF((PyObject *)__pyx_v_weight_label); + __Pyx_INCREF((PyObject *)__pyx_v_weight); + __Pyx_INCREF((PyObject *)__pyx_v_label); + __pyx_v_dec_values = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_bstruct_dec_values.buf = NULL; + __pyx_bstruct_T_values.buf = NULL; + __pyx_bstruct_T_indices.buf = NULL; + __pyx_bstruct_T_indptr.buf = NULL; + __pyx_bstruct_coef_.buf = NULL; + __pyx_bstruct_weight_label.buf = NULL; + __pyx_bstruct_weight.buf = NULL; + __pyx_bstruct_label.buf = NULL; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_values), __pyx_ptype_5numpy_ndarray, 1, "T_values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indices), __pyx_ptype_5numpy_ndarray, 1, "T_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indptr), __pyx_ptype_5numpy_ndarray, 1, "T_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coef_), __pyx_ptype_5numpy_ndarray, 1, "coef_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight_label), __pyx_ptype_5numpy_ndarray, 1, "weight_label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weight), __pyx_ptype_5numpy_ndarray, 1, "weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T_values, (PyObject*)__pyx_v_T_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_T_values = __pyx_bstruct_T_values.strides[0]; + __pyx_bshape_0_T_values = __pyx_bstruct_T_values.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T_indices, (PyObject*)__pyx_v_T_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_T_indices = __pyx_bstruct_T_indices.strides[0]; + __pyx_bshape_0_T_indices = __pyx_bstruct_T_indices.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_T_indptr, (PyObject*)__pyx_v_T_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_T_indptr = __pyx_bstruct_T_indptr.strides[0]; + __pyx_bshape_0_T_indptr = __pyx_bstruct_T_indptr.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_coef_, (PyObject*)__pyx_v_coef_, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_coef_ = __pyx_bstruct_coef_.strides[0]; __pyx_bstride_1_coef_ = __pyx_bstruct_coef_.strides[1]; + __pyx_bshape_0_coef_ = __pyx_bstruct_coef_.shape[0]; __pyx_bshape_1_coef_ = __pyx_bstruct_coef_.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight_label, (PyObject*)__pyx_v_weight_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_weight_label = __pyx_bstruct_weight_label.strides[0]; + __pyx_bshape_0_weight_label = __pyx_bstruct_weight_label.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weight, (PyObject*)__pyx_v_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_weight = __pyx_bstruct_weight.strides[0]; + __pyx_bshape_0_weight = __pyx_bstruct_weight.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_label, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_bstride_0_label = __pyx_bstruct_label.strides[0]; + __pyx_bshape_0_label = __pyx_bstruct_label.shape[0]; + + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":301 + * + * param = set_parameter(solver_type, eps, C, weight.shape[0], + * weight_label.data, weight.data) # <<<<<<<<<<<<<< + * + * model = set_model(param, coef_.data, coef_.shape, label.data, bias) + */ + __pyx_v_param = set_parameter(__pyx_v_solver_type, __pyx_v_eps, __pyx_v_C, (__pyx_v_weight->dimensions[0]), __pyx_v_weight_label->data, __pyx_v_weight->data); + + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":303 + * weight_label.data, weight.data) + * + * model = set_model(param, coef_.data, coef_.shape, label.data, bias) # <<<<<<<<<<<<<< + * cdef int nr_class = get_nr_class(model) + * dec_values = np.empty((T_indptr.shape[0]-1, nr_class), dtype=np.float64) + */ + __pyx_v_model = set_model(__pyx_v_param, __pyx_v_coef_->data, __pyx_v_coef_->dimensions, __pyx_v_label->data, __pyx_v_bias); + + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":304 + * + * model = set_model(param, coef_.data, coef_.shape, label.data, bias) + * cdef int nr_class = get_nr_class(model) # <<<<<<<<<<<<<< + * dec_values = np.empty((T_indptr.shape[0]-1, nr_class), dtype=np.float64) + * + */ + __pyx_v_nr_class = get_nr_class(__pyx_v_model); + + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":305 + * model = set_model(param, coef_.data, coef_.shape, label.data, bias) + * cdef int nr_class = get_nr_class(model) + * dec_values = np.empty((T_indptr.shape[0]-1, nr_class), dtype=np.float64) # <<<<<<<<<<<<<< + * + * if csr_copy_predict_proba(n_features, T_values.shape, T_values.data, + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(((__pyx_v_T_indptr->dimensions[0]) - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dec_values); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_dec_values, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_7 < 0)) { + PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dec_values, (PyObject*)__pyx_v_dec_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); + } + } + __pyx_bstride_0_dec_values = __pyx_bstruct_dec_values.strides[0]; __pyx_bstride_1_dec_values = __pyx_bstruct_dec_values.strides[1]; + __pyx_bshape_0_dec_values = __pyx_bstruct_dec_values.shape[0]; __pyx_bshape_1_dec_values = __pyx_bstruct_dec_values.shape[1]; + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_dec_values)); + __pyx_v_dec_values = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":310 + * T_indices.shape, T_indices.data, + * T_indptr.shape, T_indptr.data, + * model, dec_values.data) < 0: # <<<<<<<<<<<<<< + * raise MemoryError("We've run out of of memory") + * + */ + __pyx_t_11 = (csr_copy_predict_proba(__pyx_v_n_features, __pyx_v_T_values->dimensions, __pyx_v_T_values->data, __pyx_v_T_indices->dimensions, __pyx_v_T_indices->data, __pyx_v_T_indptr->dimensions, __pyx_v_T_indptr->data, __pyx_v_model, __pyx_v_dec_values->data) < 0); + if (__pyx_t_11) { + + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":311 + * T_indptr.shape, T_indptr.data, + * model, dec_values.data) < 0: + * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< + * + * ### FREE + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":314 + * + * ### FREE + * free_parameter(param) # <<<<<<<<<<<<<< + * free_and_destroy_model(&model) + * return dec_values + */ + free_parameter(__pyx_v_param); + + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":315 + * ### FREE + * free_parameter(param) + * free_and_destroy_model(&model) # <<<<<<<<<<<<<< + * return dec_values + */ + free_and_destroy_model((&__pyx_v_model)); + + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":316 + * free_parameter(param) + * free_and_destroy_model(&model) + * return dec_values # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_dec_values)); + __pyx_r = ((PyObject *)__pyx_v_dec_values); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_weight_label); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_weight); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_indices); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_values); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coef_); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_indptr); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dec_values); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_label); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_liblinear.csr_predict_prob"); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_weight_label); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_weight); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_indices); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_values); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coef_); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_T_indptr); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dec_values); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_label); + __pyx_L2:; + __Pyx_DECREF((PyObject *)__pyx_v_dec_values); + __Pyx_DECREF((PyObject *)__pyx_v_T_values); + __Pyx_DECREF((PyObject *)__pyx_v_T_indices); + __Pyx_DECREF((PyObject *)__pyx_v_T_indptr); + __Pyx_DECREF((PyObject *)__pyx_v_coef_); + __Pyx_DECREF((PyObject *)__pyx_v_weight_label); + __Pyx_DECREF((PyObject *)__pyx_v_weight); + __Pyx_DECREF((PyObject *)__pyx_v_label); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":187 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -3374,7 +3843,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __Pyx_GIVEREF(__pyx_v_info->obj); __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":193 * # of flags * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3383,7 +3852,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_endian_detector = 1; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":194 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3392,7 +3861,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":196 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -3401,7 +3870,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":198 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":198 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3411,7 +3880,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":199 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -3423,7 +3892,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } /*else*/ { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":201 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -3434,7 +3903,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } __pyx_L5:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":203 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3444,7 +3913,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":204 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -3458,7 +3927,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_3) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":205 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< @@ -3480,7 +3949,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } __pyx_L6:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":207 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3490,7 +3959,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":208 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -3504,7 +3973,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_2) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":209 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< @@ -3526,7 +3995,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } __pyx_L7:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":211 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -3535,7 +4004,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":212 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -3544,7 +4013,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":213 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -3554,7 +4023,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_6 = __pyx_v_copy_shape; if (__pyx_t_6) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":216 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -3563,7 +4032,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":217 * # as one block, strides first. * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -3572,7 +4041,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":218 * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -3583,7 +4052,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":219 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -3592,7 +4061,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":220 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -3605,7 +4074,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } /*else*/ { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":222 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -3614,7 +4083,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":223 * else: * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -3625,7 +4094,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } __pyx_L8:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":224 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) * info.shape = <Py_ssize_t*>PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -3634,7 +4103,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->suboffsets = NULL; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":225 * info.shape = <Py_ssize_t*>PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -3643,7 +4112,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":226 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -3652,7 +4121,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":229 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -3661,7 +4130,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_f = NULL; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":230 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -3671,7 +4140,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":234 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -3680,7 +4149,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":236 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -3696,7 +4165,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_1) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":238 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -3712,7 +4181,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } /*else*/ { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":241 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -3727,7 +4196,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } __pyx_L11:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":243 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -3737,7 +4206,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":244 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -3746,7 +4215,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":245 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -3761,7 +4230,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (!__pyx_t_2) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":246 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -3781,7 +4250,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_1) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":247 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< @@ -3803,7 +4272,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } __pyx_L13:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":248 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -3816,7 +4285,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":249 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -3829,7 +4298,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":250 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -3842,7 +4311,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":251 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -3855,7 +4324,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":252 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -3868,7 +4337,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":253 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -3881,7 +4350,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":254 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -3894,7 +4363,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":255 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -3907,7 +4376,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":256 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -3920,7 +4389,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":257 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -3933,7 +4402,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":258 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -3946,7 +4415,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":259 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -3959,7 +4428,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":260 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -3972,7 +4441,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":261 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -3985,7 +4454,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":262 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -3998,7 +4467,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":263 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -4011,7 +4480,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf goto __pyx_L14; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":264 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -4025,7 +4494,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } /*else*/ { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":266 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":266 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -4051,7 +4520,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } __pyx_L14:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":267 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -4060,7 +4529,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->format = __pyx_v_f; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":268 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -4073,7 +4542,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } /*else*/ { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":270 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":270 * return * else: * info.format = <char*>stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -4082,7 +4551,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":271 * else: * info.format = <char*>stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -4091,7 +4560,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ (__pyx_v_info->format[0]) = '^'; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":272 * info.format = <char*>stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -4100,7 +4569,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_offset = 0; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":275 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":275 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< @@ -4110,7 +4579,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":276 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< @@ -4143,7 +4612,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf return __pyx_r; } -/* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":278 +/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":278 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -4157,7 +4626,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __Pyx_RefNannySetupContext("__releasebuffer__"); __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":279 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -4167,7 +4636,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":280 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -4179,7 +4648,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P } __pyx_L5:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":281 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -4189,7 +4658,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":282 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -4205,7 +4674,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __Pyx_RefNannyFinishContext(); } -/* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":755 +/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":755 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -4218,7 +4687,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":756 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<< @@ -4244,7 +4713,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 +/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":758 * return PyArray_MultiIterNew(1, <void*>a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -4257,7 +4726,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":759 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<< @@ -4283,7 +4752,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":761 +/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":761 * return PyArray_MultiIterNew(2, <void*>a, <void*>b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -4296,7 +4765,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":762 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<< @@ -4322,7 +4791,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 +/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":764 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -4335,7 +4804,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":765 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<< @@ -4361,7 +4830,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 +/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":767 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -4374,7 +4843,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":768 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<< @@ -4400,7 +4869,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 +/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":770 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -4435,7 +4904,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":777 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -4444,7 +4913,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":778 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -4453,7 +4922,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":781 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -4472,7 +4941,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":782 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< @@ -4486,7 +4955,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_fields = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":783 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -4509,7 +4978,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":785 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< @@ -4534,7 +5003,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":786 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< @@ -4556,7 +5025,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __pyx_L5:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":788 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":788 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -4571,7 +5040,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } if (!__pyx_t_7) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":789 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -4591,7 +5060,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } if (__pyx_t_6) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":790 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< @@ -4613,7 +5082,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __pyx_L6:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":800 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":800 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -4630,7 +5099,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":801 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -4639,7 +5108,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":802 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -4648,7 +5117,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f += 1; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":803 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -4658,7 +5127,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx (__pyx_v_offset[0]) += 1; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":805 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":805 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -4667,7 +5136,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":807 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":807 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -4677,7 +5146,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":808 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< @@ -4690,7 +5159,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":809 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -4700,7 +5169,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":810 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< @@ -4722,7 +5191,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __pyx_L10:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":813 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":813 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< @@ -4741,7 +5210,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":814 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< @@ -4760,7 +5229,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":815 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< @@ -4779,7 +5248,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":816 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< @@ -4798,7 +5267,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":817 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< @@ -4817,7 +5286,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":818 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< @@ -4836,7 +5305,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":819 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< @@ -4855,7 +5324,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":820 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< @@ -4874,7 +5343,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":821 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< @@ -4893,7 +5362,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":822 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< @@ -4912,7 +5381,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":823 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< @@ -4931,7 +5400,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":824 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< @@ -4950,7 +5419,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":825 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< @@ -4969,7 +5438,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":826 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< @@ -4990,7 +5459,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":827 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< @@ -5011,7 +5480,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":828 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< @@ -5032,7 +5501,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L11; } - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":829 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< @@ -5052,7 +5521,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } /*else*/ { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":831 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":831 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -5075,7 +5544,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __pyx_L11:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":832 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -5087,7 +5556,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } /*else*/ { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":836 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":836 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< @@ -5101,7 +5570,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":837 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -5131,7 +5600,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":952 +/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":952 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -5146,7 +5615,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_INCREF((PyObject *)__pyx_v_arr); __Pyx_INCREF(__pyx_v_base); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":954 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":954 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -5156,7 +5625,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":955 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -5168,7 +5637,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":957 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":957 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -5177,7 +5646,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":958 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = <PyObject*>base # <<<<<<<<<<<<<< @@ -5188,7 +5657,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":959 * Py_INCREF(base) # important to do this before decref below! * baseptr = <PyObject*>base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -5197,7 +5666,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":960 * baseptr = <PyObject*>base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -5211,7 +5680,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":962 +/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":962 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5225,7 +5694,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __Pyx_RefNannySetupContext("get_array_base"); __Pyx_INCREF((PyObject *)__pyx_v_arr); - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":963 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -5235,7 +5704,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":964 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -5250,7 +5719,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":966 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":966 * return None * else: * return <object>arr.base # <<<<<<<<<<<<<< @@ -5276,6 +5745,7 @@ static struct PyMethodDef __pyx_methods[] = { {__Pyx_NAMESTR("predict_wrap"), (PyCFunction)__pyx_pf_10_liblinear_predict_wrap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("csr_predict_wrap"), (PyCFunction)__pyx_pf_10_liblinear_csr_predict_wrap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10_liblinear_csr_predict_wrap)}, {__Pyx_NAMESTR("predict_prob_wrap"), (PyCFunction)__pyx_pf_10_liblinear_predict_prob_wrap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10_liblinear_predict_prob_wrap)}, + {__Pyx_NAMESTR("csr_predict_prob"), (PyCFunction)__pyx_pf_10_liblinear_csr_predict_prob, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10_liblinear_csr_predict_prob)}, {0, 0, 0, 0} }; @@ -5300,6 +5770,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, @@ -5327,6 +5798,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, {&__pyx_n_s__coef_, __pyx_k__coef_, sizeof(__pyx_k__coef_), 0, 0, 1, 1}, + {&__pyx_n_s__csr_predict_prob, __pyx_k__csr_predict_prob, sizeof(__pyx_k__csr_predict_prob), 0, 0, 1, 1}, {&__pyx_n_s__csr_predict_wrap, __pyx_k__csr_predict_wrap, sizeof(__pyx_k__csr_predict_wrap), 0, 0, 1, 1}, {&__pyx_n_s__csr_train_wrap, __pyx_k__csr_train_wrap, sizeof(__pyx_k__csr_train_wrap), 0, 0, 1, 1}, {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, @@ -5360,8 +5832,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -5446,7 +5918,7 @@ PyMODINIT_FUNC PyInit__liblinear(void) /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":7 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":7 * """ * * import numpy as np # <<<<<<<<<<<<<< @@ -5458,7 +5930,7 @@ PyMODINIT_FUNC PyInit__liblinear(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/fabian/dev/scikit-learn/scikits/learn/src/liblinear/_liblinear.pyx":1 + /* "/home/fabian/dev/scikit-learn/scikits/learn/svm/src/liblinear/_liblinear.pyx":1 * """ # <<<<<<<<<<<<<< * Wrapper for liblinear * @@ -5493,10 +5965,17 @@ PyMODINIT_FUNC PyInit__liblinear(void) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_12), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__csr_predict_prob); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_13), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 + /* "/usr/lib/pymodules/python2.6/Cython/Includes/stdlib.pxd":2 * * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< * void free(void *ptr) diff --git a/scikits/learn/svm/src/liblinear/_liblinear.pyx b/scikits/learn/svm/src/liblinear/_liblinear.pyx index 6e70d8185434ce5e48eb3dee353cded10aa7e6a2..bb4b3add762cd562547e5f165143801c6021b504 100644 --- a/scikits/learn/svm/src/liblinear/_liblinear.pyx +++ b/scikits/learn/svm/src/liblinear/_liblinear.pyx @@ -16,7 +16,7 @@ cdef extern from "linear.h": model *train (problem *prob, parameter *param) int get_nr_feature (model *model) int get_nr_class (model *model) - void destroy_model (model *) + void free_and_destroy_model (model **) void destroy_param (parameter *) cdef extern from "liblinear_helper.c": @@ -34,6 +34,13 @@ cdef extern from "liblinear_helper.c": int csr_copy_predict (np.npy_intp n_features, np.npy_intp *data_size, char *data, np.npy_intp *index_size, char *index, np.npy_intp *intptr_size, char *intptr, model *model, char *dec_values) + + int csr_copy_predict_proba(np.npy_intp n_features, np.npy_intp *data_size, + char *data, np.npy_intp *index_size, + char *index, np.npy_intp *indptr_shape, + char *indptr, model *model_, + char *dec_values) + int copy_prob_predict(char *, model *, np.npy_intp *, char *) int copy_label(char *, model *, int) double get_bias(model *) @@ -85,7 +92,7 @@ def train_wrap ( np.ndarray[np.float64_t, ndim=2, mode='c'] X, copy_label(label.data, model, nr_class) ### FREE - destroy_model(model) + free_and_destroy_model(&model) free_problem(problem) free_parameter(param) # destroy_param(param) don't call this or it will destroy weight_label and weight @@ -142,7 +149,7 @@ def csr_train_wrap ( int n_features, copy_label(label.data, model, nr_class) ### FREE - destroy_model(model) + free_and_destroy_model(&model) free_problem(problem) free_parameter(param) # destroy_param(param) don't call this or it will destroy weight_label and weight @@ -171,7 +178,7 @@ def predict_wrap(np.ndarray[np.float64_t, ndim=2, mode='c'] T, ### FREE free_parameter(param) - destroy_model(model) + free_and_destroy_model(&model) return dec_values @@ -209,7 +216,7 @@ def csr_predict_wrap( ### FREE free_parameter(param) - destroy_model(model) + free_and_destroy_model(&model) return dec_values @@ -263,6 +270,47 @@ def predict_prob_wrap(np.ndarray[np.float64_t, ndim=2, mode='c'] T, ### FREE free_parameter(param) - destroy_model(model) + free_and_destroy_model(&model) + + return dec_values + + + +def csr_predict_prob( + int n_features, + np.ndarray[np.float64_t, ndim=1, mode='c'] T_values, + np.ndarray[np.int32_t, ndim=1, mode='c'] T_indices, + np.ndarray[np.int32_t, ndim=1, mode='c'] T_indptr, + np.ndarray[np.float64_t, ndim=2, mode='c'] coef_, + int solver_type, double eps, double C, + np.ndarray[np.int32_t, ndim=1, mode='c'] weight_label, + np.ndarray[np.float64_t, ndim=1, mode='c'] weight, + np.ndarray[np.int32_t, ndim=1, mode='c'] label, + double bias): + """ + Predict probability from model + Test data given in CSR format + """ + + cdef np.ndarray[np.float64_t, ndim=2, mode='c'] dec_values + cdef parameter *param + cdef model *model + + param = set_parameter(solver_type, eps, C, weight.shape[0], + weight_label.data, weight.data) + + model = set_model(param, coef_.data, coef_.shape, label.data, bias) + cdef int nr_class = get_nr_class(model) + dec_values = np.empty((T_indptr.shape[0]-1, nr_class), dtype=np.float64) + + if csr_copy_predict_proba(n_features, T_values.shape, T_values.data, + T_indices.shape, T_indices.data, + T_indptr.shape, T_indptr.data, + model, dec_values.data) < 0: + raise MemoryError("We've run out of of memory") + + ### FREE + free_parameter(param) + free_and_destroy_model(&model) return dec_values diff --git a/scikits/learn/svm/src/liblinear/liblinear_helper.c b/scikits/learn/svm/src/liblinear/liblinear_helper.c index 47472355bff290e502049e3273b71a65735eb522..7544bbcf7b2a92d51428e2aea61b872163da2201 100644 --- a/scikits/learn/svm/src/liblinear/liblinear_helper.c +++ b/scikits/learn/svm/src/liblinear/liblinear_helper.c @@ -165,9 +165,9 @@ struct model * set_model(struct parameter *param, char *coef, npy_intp *dims, struct model *model; if (m == 1) m = 2; /* liblinear collapses the weight vector in the case of two classes */ - model = (struct model *) malloc(sizeof(struct model)); + model = (struct model *) malloc(sizeof(struct model)); model->w = (double *) malloc( len_w * sizeof(double)); - model->label = (int *) malloc( m * sizeof(int));; + model->label = (int *) malloc( m * sizeof(int)); memcpy(model->label, label, m * sizeof(int)); memcpy(model->w, coef, len_w * sizeof(double)); @@ -250,10 +250,8 @@ int csr_copy_predict(npy_intp n_features, npy_intp *data_size, char *data, int copy_prob_predict(char *predict, struct model *model_, npy_intp *predict_dims, char *dec_values) { - double *t = (double *) dec_values; struct feature_node **predict_nodes; register int i; - double temp; int n, m; n = predict_dims[0]; m = model_->nr_class; @@ -270,6 +268,33 @@ int copy_prob_predict(char *predict, struct model *model_, npy_intp *predict_dim } +int csr_copy_predict_proba(npy_intp n_features, npy_intp *data_size, + char *data, npy_intp *index_size, + char *index, npy_intp *indptr_shape, + char *indptr, struct model *model_, + char *dec_values) +{ + struct feature_node **predict_nodes; + register int i; + double temp; + double *tx = (double *) dec_values; + + predict_nodes = csr_to_sparse((double *) data, index_size, + (int *) index, indptr_shape, + (int *) indptr, model_->bias, + n_features); + if (predict_nodes == NULL) + return -1; + for(i=0; i<indptr_shape[0] - 1; ++i) { + predict_probability(model_, predict_nodes[i], tx); + tx += model_->nr_class; + free(predict_nodes[i]); + } + free(predict_nodes); + return 0; +} + + int copy_label(char *data, struct model *model_, int nr_class) { memcpy(data, model_->label, nr_class * sizeof(int)); diff --git a/scikits/learn/svm/src/liblinear/linear.cpp b/scikits/learn/svm/src/liblinear/linear.cpp index 27465854e081eee83411f0ac854cb9970b30bdad..baf08d02e4ecc7a1b464275c17e132a5894e6beb 100644 --- a/scikits/learn/svm/src/liblinear/linear.cpp +++ b/scikits/learn/svm/src/liblinear/linear.cpp @@ -27,7 +27,7 @@ static void print_string_stdout(const char *s) fflush(stdout); } -void (*liblinear_print_string) (const char *) = &print_string_stdout; +static void (*liblinear_print_string) (const char *) = &print_string_stdout; #if 0 static void info(const char *fmt,...) @@ -391,6 +391,8 @@ void l2r_l2_svc_fun::subXTv(double *v, double *XTv) // eps is the stopping tolerance // // solution will be put in w +// +// See Appendix of LIBLINEAR paper, Fan et al. (2008) #define GETI(i) (prob->y[i]) // To support weights for instances, use GETI(i) (i) @@ -420,9 +422,9 @@ Solver_MCSVM_CS::Solver_MCSVM_CS(const problem *prob, int nr_class, double *weig this->eps = eps; this->max_iter = max_iter; this->prob = prob; - this->C = weighted_C; this->B = new double[nr_class]; this->G = new double[nr_class]; + this->C = weighted_C; } Solver_MCSVM_CS::~Solver_MCSVM_CS() @@ -646,7 +648,7 @@ void Solver_MCSVM_CS::Solve(double *w) info("\noptimization finished, #iter = %d\n",iter); if (iter >= max_iter) - info("Warning: reaching max number of iterations\n"); + info("\nWARNING: reaching max number of iterations\n"); // calculate objective value double v = 0; @@ -699,6 +701,8 @@ void Solver_MCSVM_CS::Solve(double *w) // eps is the stopping tolerance // // solution will be put in w +// +// See Algorithm 3 of Hsieh et al., ICML 2008 #undef GETI #define GETI(i) (y[i]+1) @@ -771,7 +775,7 @@ static void solve_l2r_l1l2_svc( swap(index[i], index[j]); } - for (s=0;s<active_size;s++) + for (s=0; s<active_size; s++) { i = index[s]; G = 0; @@ -883,6 +887,174 @@ static void solve_l2r_l1l2_svc( delete [] index; } +// A coordinate descent algorithm for +// the dual of L2-regularized logistic regression problems +// +// min_\alpha 0.5(\alpha^T Q \alpha) + \sum \alpha_i log (\alpha_i) + (upper_bound_i - alpha_i) log (upper_bound_i - alpha_i) , +// s.t. 0 <= alpha_i <= upper_bound_i, +// +// where Qij = yi yj xi^T xj and +// upper_bound_i = Cp if y_i = 1 +// upper_bound_i = Cn if y_i = -1 +// +// Given: +// x, y, Cp, Cn +// eps is the stopping tolerance +// +// solution will be put in w +// +// See Algorithm 5 of Yu et al., MLJ 2010 + +#undef GETI +#define GETI(i) (y[i]+1) +// To support weights for instances, use GETI(i) (i) + +void solve_l2r_lr_dual(const problem *prob, double *w, double eps, double Cp, double Cn) +{ + int l = prob->l; + int w_size = prob->n; + int i, s, iter = 0; + double *xTx = new double[l]; + int max_iter = 1000; + int *index = new int[l]; + double *alpha = new double[2*l]; // store alpha and C - alpha + schar *y = new schar[l]; + int max_inner_iter = 100; // for inner Newton + double innereps = 1e-2; + double innereps_min = min(1e-8, eps); + double upper_bound[3] = {Cn, 0, Cp}; + + for(i=0; i<w_size; i++) + w[i] = 0; + for(i=0; i<l; i++) + { + if(prob->y[i] > 0) + { + y[i] = +1; + } + else + { + y[i] = -1; + } + alpha[2*i] = min(0.001*upper_bound[GETI(i)], 1e-8); + alpha[2*i+1] = upper_bound[GETI(i)] - alpha[2*i]; + + xTx[i] = 0; + feature_node *xi = prob->x[i]; + while (xi->index != -1) + { + xTx[i] += (xi->value)*(xi->value); + w[xi->index-1] += y[i]*alpha[2*i]*xi->value; + xi++; + } + index[i] = i; + } + + while (iter < max_iter) + { + for (i=0; i<l; i++) + { + int j = i+rand()%(l-i); + swap(index[i], index[j]); + } + int newton_iter = 0; + double Gmax = 0; + for (s=0; s<l; s++) + { + i = index[s]; + schar yi = y[i]; + double C = upper_bound[GETI(i)]; + double ywTx = 0, xisq = xTx[i]; + feature_node *xi = prob->x[i]; + while (xi->index != -1) + { + ywTx += w[xi->index-1]*xi->value; + xi++; + } + ywTx *= y[i]; + double a = xisq, b = ywTx; + + // Decide to minimize g_1(z) or g_2(z) + int ind1 = 2*i, ind2 = 2*i+1, sign = 1; + if(0.5*a*(alpha[ind2]-alpha[ind1])+b < 0) + { + ind1 = 2*i+1; + ind2 = 2*i; + sign = -1; + } + + // g_t(z) = z*log(z) + (C-z)*log(C-z) + 0.5a(z-alpha_old)^2 + sign*b(z-alpha_old) + double alpha_old = alpha[ind1]; + double z = alpha_old; + if(C - z < 0.5 * C) + z = 0.1*z; + double gp = a*(z-alpha_old)+sign*b+log(z/(C-z)); + Gmax = max(Gmax, fabs(gp)); + + // Newton method on the sub-problem + const double eta = 0.1; // xi in the paper + int inner_iter = 0; + while (inner_iter <= max_inner_iter) + { + if(fabs(gp) < innereps) + break; + double gpp = a + C/(C-z)/z; + double tmpz = z - gp/gpp; + if(tmpz <= 0) + z *= eta; + else // tmpz in (0, C) + z = tmpz; + gp = a*(z-alpha_old)+sign*b+log(z/(C-z)); + newton_iter++; + inner_iter++; + } + + if(inner_iter > 0) // update w + { + alpha[ind1] = z; + alpha[ind2] = C-z; + xi = prob->x[i]; + while (xi->index != -1) + { + w[xi->index-1] += sign*(z-alpha_old)*yi*xi->value; + xi++; + } + } + } + + iter++; + if(iter % 10 == 0) + info("."); + + if(Gmax < eps) + break; + + if(newton_iter < l/10) + innereps = max(innereps_min, 0.1*innereps); + + } + + info("\noptimization finished, #iter = %d\n",iter); + if (iter >= max_iter) + info("\nWARNING: reaching max number of iterations\nUsing -s 0 may be faster (also see FAQ)\n\n"); + + // calculate objective value + + double v = 0; + for(i=0; i<w_size; i++) + v += w[i] * w[i]; + v *= 0.5; + for(i=0; i<l; i++) + v += alpha[2*i] * log(alpha[2*i]) + alpha[2*i+1] * log(alpha[2*i+1]) + - upper_bound[GETI(i)] * log(upper_bound[GETI(i)]); + info("Objective value = %lf\n", v); + + delete [] xTx; + delete [] alpha; + delete [] y; + delete [] index; +} + // A coordinate descent algorithm for // L1-regularized L2-loss support vector classification // @@ -893,6 +1065,8 @@ static void solve_l2r_l1l2_svc( // eps is the stopping tolerance // // solution will be put in w +// +// See Yuan et al. (2010) and appendix of LIBLINEAR paper, Fan et al. (2008) #undef GETI #define GETI(i) (y[i]+1) @@ -1172,6 +1346,8 @@ static void solve_l1r_l2_svc( // eps is the stopping tolerance // // solution will be put in w +// +// See Yuan et al. (2010) and appendix of LIBLINEAR paper, Fan et al. (2008) #undef GETI #define GETI(i) (y[i]+1) @@ -1621,6 +1797,9 @@ static void train_one(const problem *prob, const parameter *param, double *w, do delete [] x_space; break; } + case L2R_LR_DUAL: + solve_l2r_lr_dual(prob, w, eps, Cp, Cn); + break; default: fprintf(stderr, "Error: unknown solver_type\n"); break; @@ -1669,7 +1848,7 @@ model* train(const problem *prob, const parameter *param) if(param->weight_label[i] == label[j]) break; if(j == nr_class) - fprintf(stderr,"warning: class label %d specified in weight is not found\n", param->weight_label[i]); + fprintf(stderr,"WARNING: class label %d specified in weight is not found\n", param->weight_label[i]); else weighted_C[j] *= param->weight[i]; } @@ -1752,18 +1931,147 @@ model* train(const problem *prob, const parameter *param) return model_; } -void destroy_model(struct model *model_) +void cross_validation(const problem *prob, const parameter *param, int nr_fold, int *target) { - if(model_->w != NULL) - free(model_->w); - if(model_->label != NULL) - free(model_->label); - free(model_); + int i; + int *fold_start = Malloc(int,nr_fold+1); + int l = prob->l; + int *perm = Malloc(int,l); + + for(i=0;i<l;i++) perm[i]=i; + for(i=0;i<l;i++) + { + int j = i+rand()%(l-i); + swap(perm[i],perm[j]); + } + for(i=0;i<=nr_fold;i++) + fold_start[i]=i*l/nr_fold; + + for(i=0;i<nr_fold;i++) + { + int begin = fold_start[i]; + int end = fold_start[i+1]; + int j,k; + struct problem subprob; + + subprob.bias = prob->bias; + subprob.n = prob->n; + subprob.l = l-(end-begin); + subprob.x = Malloc(struct feature_node*,subprob.l); + subprob.y = Malloc(int,subprob.l); + + k=0; + for(j=0;j<begin;j++) + { + subprob.x[k] = prob->x[perm[j]]; + subprob.y[k] = prob->y[perm[j]]; + ++k; + } + for(j=end;j<l;j++) + { + subprob.x[k] = prob->x[perm[j]]; + subprob.y[k] = prob->y[perm[j]]; + ++k; + } + struct model *submodel = train(&subprob,param); + for(j=begin;j<end;j++) + target[perm[j]] = predict(submodel,prob->x[perm[j]]); + free_and_destroy_model(&submodel); + free(subprob.x); + free(subprob.y); + } + free(fold_start); + free(perm); +} + +int predict_values(const struct model *model_, const struct feature_node *x, double *dec_values) +{ + int idx; + int n; + if(model_->bias>=0) + n=model_->nr_feature+1; + else + n=model_->nr_feature; + double *w=model_->w; + int nr_class=model_->nr_class; + int i; + int nr_w; + if(nr_class==2 && model_->param.solver_type != MCSVM_CS) + nr_w = 1; + else + nr_w = nr_class; + + const feature_node *lx=x; + for(i=0;i<nr_w;i++) + dec_values[i] = 0; + for(; (idx=lx->index)!=-1; lx++) + { + // the dimension of testing data may exceed that of training + if(idx<=n) + for(i=0;i<nr_w;i++) + dec_values[i] += w[(idx-1)*nr_w+i]*lx->value; + } + + if(nr_class==2) + return (dec_values[0]>0)?model_->label[0]:model_->label[1]; + else + { + int dec_max_idx = 0; + for(i=1;i<nr_class;i++) + { + if(dec_values[i] > dec_values[dec_max_idx]) + dec_max_idx = i; + } + return model_->label[dec_max_idx]; + } +} + +int predict(const model *model_, const feature_node *x) +{ + double *dec_values = Malloc(double, model_->nr_class); + int label=predict_values(model_, x, dec_values); + free(dec_values); + return label; +} + +int predict_probability(const struct model *model_, const struct feature_node *x, double* prob_estimates) +{ + if(check_probability_model(model_)) + { + int i; + int nr_class=model_->nr_class; + int nr_w; + if(nr_class==2) + nr_w = 1; + else + nr_w = nr_class; + + int label=predict_values(model_, x, prob_estimates); + for(i=0;i<nr_w;i++) + prob_estimates[i]=1/(1+exp(-prob_estimates[i])); + + if(nr_class==2) // for binary classification + prob_estimates[1]=1.-prob_estimates[0]; + else + { + double sum=0; + for(i=0; i<nr_class; i++) + sum+=prob_estimates[i]; + + for(i=0; i<nr_class; i++) + prob_estimates[i]=prob_estimates[i]/sum; + } + + return label; + } + else + return 0; } static const char *solver_type_table[]= { - "L2R_LR", "L2R_L2LOSS_SVC_DUAL", "L2R_L2LOSS_SVC","L2R_L1LOSS_SVC_DUAL","MCSVM_CS", "L1R_L2LOSS_SVC","L1R_LR", NULL + "L2R_LR", "L2R_L2LOSS_SVC_DUAL", "L2R_L2LOSS_SVC", "L2R_L1LOSS_SVC_DUAL", "MCSVM_CS", + "L1R_L2LOSS_SVC", "L1R_LR", "L2R_LR_DUAL", NULL }; int save_model(const char *model_file_name, const struct model *model_) @@ -1909,88 +2217,39 @@ struct model *load_model(const char *model_file_name) return model_; } -int predict_values(const struct model *model_, const struct feature_node *x, double *dec_values) +int get_nr_feature(const model *model_) { - int idx; - int n; - if(model_->bias>=0) - n=model_->nr_feature+1; - else - n=model_->nr_feature; - double *w=model_->w; - int nr_class=model_->nr_class; - int i; - int nr_w; - if(nr_class==2 && model_->param.solver_type != MCSVM_CS) - nr_w = 1; - else - nr_w = nr_class; + return model_->nr_feature; +} - const feature_node *lx=x; - for(i=0;i<nr_w;i++) - dec_values[i] = 0; - for(; (idx=lx->index)!=-1; lx++) - { - // the dimension of testing data may exceed that of training - if(idx<=n) - for(i=0;i<nr_w;i++) - dec_values[i] += w[(idx-1)*nr_w+i]*lx->value; - } +int get_nr_class(const model *model_) +{ + return model_->nr_class; +} - if(nr_class==2) - return (dec_values[0]>0)?model_->label[0]:model_->label[1]; - else - { - int dec_max_idx = 0; - for(i=1;i<nr_class;i++) - { - if(dec_values[i] > dec_values[dec_max_idx]) - dec_max_idx = i; - } - return model_->label[dec_max_idx]; - } +void get_labels(const model *model_, int* label) +{ + if (model_->label != NULL) + for(int i=0;i<model_->nr_class;i++) + label[i] = model_->label[i]; } -int predict(const model *model_, const feature_node *x) +void free_model_content(struct model *model_ptr) { - double *dec_values = Malloc(double, model_->nr_class); - int label=predict_values(model_, x, dec_values); - free(dec_values); - return label; + if(model_ptr->w != NULL) + free(model_ptr->w); + if(model_ptr->label != NULL) + free(model_ptr->label); } -int predict_probability(const struct model *model_, const struct feature_node *x, double* prob_estimates) +void free_and_destroy_model(struct model **model_ptr_ptr) { - if(model_->param.solver_type==L2R_LR || model_->param.solver_type == L1R_LR) + struct model *model_ptr = *model_ptr_ptr; + if(model_ptr != NULL) { - int i; - int nr_class=model_->nr_class; - int nr_w; - if(nr_class==2) - nr_w = 1; - else - nr_w = nr_class; - - int label=predict_values(model_, x, prob_estimates); - for(i=0;i<nr_w;i++) - prob_estimates[i]=1/(1+exp(-prob_estimates[i])); - - if(nr_class==2) // for binary classification - prob_estimates[1]=1.-prob_estimates[0]; - else - { - double sum=0; - for(i=0; i<nr_class; i++) - sum+=prob_estimates[i]; - - for(i=0; i<nr_class; i++) - prob_estimates[i]=prob_estimates[i]/sum; - } - - return label; + free_model_content(model_ptr); + free(model_ptr); } - else - return 0; } void destroy_param(parameter* param) @@ -2015,79 +2274,25 @@ const char *check_parameter(const problem *prob, const parameter *param) && param->solver_type != L2R_L1LOSS_SVC_DUAL && param->solver_type != MCSVM_CS && param->solver_type != L1R_L2LOSS_SVC - && param->solver_type != L1R_LR) + && param->solver_type != L1R_LR + && param->solver_type != L2R_LR_DUAL) return "unknown solver type"; return NULL; } -void cross_validation(const problem *prob, const parameter *param, int nr_fold, int *target) +int check_probability_model(const struct model *model_) { - int i; - int *fold_start = Malloc(int,nr_fold+1); - int l = prob->l; - int *perm = Malloc(int,l); - - for(i=0;i<l;i++) perm[i]=i; - for(i=0;i<l;i++) - { - int j = i+rand()%(l-i); - swap(perm[i],perm[j]); - } - for(i=0;i<=nr_fold;i++) - fold_start[i]=i*l/nr_fold; - - for(i=0;i<nr_fold;i++) - { - int begin = fold_start[i]; - int end = fold_start[i+1]; - int j,k; - struct problem subprob; - - subprob.bias = prob->bias; - subprob.n = prob->n; - subprob.l = l-(end-begin); - subprob.x = Malloc(struct feature_node*,subprob.l); - subprob.y = Malloc(int,subprob.l); - - k=0; - for(j=0;j<begin;j++) - { - subprob.x[k] = prob->x[perm[j]]; - subprob.y[k] = prob->y[perm[j]]; - ++k; - } - for(j=end;j<l;j++) - { - subprob.x[k] = prob->x[perm[j]]; - subprob.y[k] = prob->y[perm[j]]; - ++k; - } - struct model *submodel = train(&subprob,param); - for(j=begin;j<end;j++) - target[perm[j]] = predict(submodel,prob->x[perm[j]]); - destroy_model(submodel); - free(subprob.x); - free(subprob.y); - } - free(fold_start); - free(perm); + return (model_->param.solver_type==L2R_LR || + model_->param.solver_type==L2R_LR_DUAL || + model_->param.solver_type==L1R_LR); } -int get_nr_feature(const model *model_) +void set_print_string_function(void (*print_func)(const char*)) { - return model_->nr_feature; -} - -int get_nr_class(const model *model_) -{ - return model_->nr_class; -} - -void get_labels(const model *model_, int* label) -{ - if (model_->label != NULL) - for(int i=0;i<model_->nr_class;i++) - label[i] = model_->label[i]; + if (print_func == NULL) + liblinear_print_string = &print_string_stdout; + else + liblinear_print_string = print_func; } diff --git a/scikits/learn/svm/src/liblinear/linear.h b/scikits/learn/svm/src/liblinear/linear.h index 51ff608fc2ea003d809fa3012b545360df920c53..2a1aa28d2d4e5aab647dffe3ac0a66e2c55ba248 100644 --- a/scikits/learn/svm/src/liblinear/linear.h +++ b/scikits/learn/svm/src/liblinear/linear.h @@ -19,7 +19,7 @@ struct problem double bias; /* < 0 if no bias term */ }; -enum { L2R_LR, L2R_L2LOSS_SVC_DUAL, L2R_L2LOSS_SVC, L2R_L1LOSS_SVC_DUAL, MCSVM_CS, L1R_L2LOSS_SVC, L1R_LR }; /* solver_type */ +enum { L2R_LR, L2R_L2LOSS_SVC_DUAL, L2R_L2LOSS_SVC, L2R_L1LOSS_SVC_DUAL, MCSVM_CS, L1R_L2LOSS_SVC, L1R_LR, L2R_LR_DUAL }; /* solver_type */ struct parameter { @@ -57,10 +57,13 @@ int get_nr_feature(const struct model *model_); int get_nr_class(const struct model *model_); void get_labels(const struct model *model_, int* label); -void destroy_model(struct model *model_); +void free_model_content(struct model *model_ptr); +void free_and_destroy_model(struct model **model_ptr_ptr); void destroy_param(struct parameter *param); + const char *check_parameter(const struct problem *prob, const struct parameter *param); -extern void (*liblinear_print_string) (const char *); +int check_probability_model(const struct model *model); +void set_print_string_function(void (*print_func) (const char*)); #ifdef __cplusplus } diff --git a/scikits/learn/svm/src/liblinear/tron.cpp b/scikits/learn/svm/src/liblinear/tron.cpp index 955dfc8f0ea05b9cc3d6fa773d214f07eff4f41a..f72adebf0828bed2f98194a4c7319484c3367b7d 100644 --- a/scikits/learn/svm/src/liblinear/tron.cpp +++ b/scikits/learn/svm/src/liblinear/tron.cpp @@ -31,19 +31,15 @@ static void default_print(const char *buf) fflush(stdout); } -#if 0 void TRON::info(const char *fmt,...) { - char buf[BUFSIZ]; - va_list ap; - va_start(ap,fmt); - vsprintf(buf,fmt,ap); - va_end(ap); - (*tron_print_string)(buf); + // char buf[BUFSIZ]; + // va_list ap; + // va_start(ap,fmt); + // vsprintf(buf,fmt,ap); + // va_end(ap); + // (*tron_print_string)(buf); } -#else -void TRON::info(const char *fmt, ...) {} -#endif TRON::TRON(const function *fun_obj, double eps, int max_iter) { diff --git a/scikits/learn/svm/src/libsvm/_libsvm.c b/scikits/learn/svm/src/libsvm/_libsvm.c index cbb3259cc7b0b6c255261ae3653bbdec1e119755..6fd0cbfb40749fc02fb6c47de53bac0d2a89c7c4 100644 --- a/scikits/learn/svm/src/libsvm/_libsvm.c +++ b/scikits/learn/svm/src/libsvm/_libsvm.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.12.1 on Thu Oct 21 09:53:48 2010 */ +/* Generated by Cython 0.12.1 on Thu Oct 21 15:19:02 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" diff --git a/scikits/learn/svm/src/libsvm/_libsvm_sparse.c b/scikits/learn/svm/src/libsvm/_libsvm_sparse.c index a09ac27d57536caf142c1909f84f1d56c33242b6..58ae997d089dca3f916a25e7e9d05666b0f7439b 100644 --- a/scikits/learn/svm/src/libsvm/_libsvm_sparse.c +++ b/scikits/learn/svm/src/libsvm/_libsvm_sparse.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.12.1 on Thu Oct 21 10:49:59 2010 */ +/* Generated by Cython 0.12.1 on Thu Oct 21 15:33:49 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -157,7 +157,7 @@ #include "stdio.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#include "svm_csr.h" +#include "svm.h" #include "libsvm_sparse_helper.c" #ifndef CYTHON_INLINE @@ -862,8 +862,8 @@ static PyObject *__pyx_pf_14_libsvm_sparse_libsvm_sparse_train(PyObject *__pyx_s int __pyx_v_shrinking; int __pyx_v_probability; struct svm_parameter *__pyx_v_param; - struct svm_problem *__pyx_v_problem; - struct svm_model *__pyx_v_model; + struct svm_csr_problem *__pyx_v_problem; + struct svm_csr_model *__pyx_v_model; char *__pyx_v_error_msg; npy_intp __pyx_v_SV_len; npy_intp __pyx_v_nr; @@ -2025,7 +2025,7 @@ static PyObject *__pyx_pf_14_libsvm_sparse_libsvm_sparse_predict(PyObject *__pyx PyArrayObject *__pyx_v_probB = 0; PyArrayObject *__pyx_v_dec_values; struct svm_parameter *__pyx_v_param; - struct svm_model *__pyx_v_model; + struct svm_csr_model *__pyx_v_model; Py_buffer __pyx_bstruct_nSV; Py_ssize_t __pyx_bstride_0_nSV = 0; Py_ssize_t __pyx_bshape_0_nSV = 0; diff --git a/scikits/learn/svm/src/libsvm/_libsvm_sparse.pyx b/scikits/learn/svm/src/libsvm/_libsvm_sparse.pyx index 147111a82946550550529610143f9808459ebf6f..5337f35746bff4039f55c6afa610ee815eb3057b 100644 --- a/scikits/learn/svm/src/libsvm/_libsvm_sparse.pyx +++ b/scikits/learn/svm/src/libsvm/_libsvm_sparse.pyx @@ -5,20 +5,20 @@ cimport numpy as np ################################################################################ # Includes -cdef extern from "svm_csr.h": - cdef struct svm_node - cdef struct svm_model +cdef extern from "svm.h": + cdef struct svm_csr_node + cdef struct svm_csr_model cdef struct svm_parameter - cdef struct svm_problem - char *svm_csr_check_parameter(svm_problem *, svm_parameter *) - svm_model *svm_csr_train(svm_problem *, svm_parameter *) - void svm_csr_free_and_destroy_model(svm_model** model_ptr_ptr) + cdef struct svm_csr_problem + char *svm_csr_check_parameter(svm_csr_problem *, svm_parameter *) + svm_csr_model *svm_csr_train(svm_csr_problem *, svm_parameter *) + void svm_csr_free_and_destroy_model(svm_csr_model** model_ptr_ptr) cdef extern from "libsvm_sparse_helper.c": # this file contains methods for accessing libsvm 'hidden' fields - svm_problem * csr_set_problem (char *, np.npy_intp *, + svm_csr_problem * csr_set_problem (char *, np.npy_intp *, char *, np.npy_intp *, char *, char *, int ) - svm_model *csr_set_model(svm_parameter *param, int nr_class, + svm_csr_model *csr_set_model(svm_parameter *param, int nr_class, char *SV_data, np.npy_intp *SV_indices_dims, char *SV_indices, np.npy_intp *SV_intptr_dims, char *SV_intptr, @@ -27,28 +27,28 @@ cdef extern from "libsvm_sparse_helper.c": svm_parameter *set_parameter (int , int , int , double, double , double , double , double , double, double, int, int, int, char *, char *) - void copy_sv_coef (char *, svm_model *) - void copy_intercept (char *, svm_model *, np.npy_intp *) - int copy_predict (char *, svm_model *, np.npy_intp *, char *) + void copy_sv_coef (char *, svm_csr_model *) + void copy_intercept (char *, svm_csr_model *, np.npy_intp *) + int copy_predict (char *, svm_csr_model *, np.npy_intp *, char *) int csr_copy_predict (np.npy_intp *data_size, char *data, np.npy_intp *index_size, char *index, np.npy_intp *intptr_size, char *size, - svm_model *model, char *dec_values) - int copy_predict_proba (char *, svm_model *, np.npy_intp *, char *) - int copy_predict_values(char *, svm_model *, np.npy_intp *, char *, int) + svm_csr_model *model, char *dec_values) + int copy_predict_proba (char *, svm_csr_model *, np.npy_intp *, char *) + int copy_predict_values(char *, svm_csr_model *, np.npy_intp *, char *, int) int csr_copy_SV (char *values, np.npy_intp *n_indices, char *indices, np.npy_intp *n_indptr, char *indptr, - svm_model *model, int n_features) - np.npy_intp get_nonzero_SV ( svm_model *) - void copy_nSV (char *, svm_model *) - void copy_label (char *, svm_model *) - void copy_probA (char *, svm_model *, np.npy_intp *) - void copy_probB (char *, svm_model *, np.npy_intp *) - np.npy_intp get_l (svm_model *) - np.npy_intp get_nr (svm_model *) - int free_problem (svm_problem *) - int free_model (svm_model *) + svm_csr_model *model, int n_features) + np.npy_intp get_nonzero_SV ( svm_csr_model *) + void copy_nSV (char *, svm_csr_model *) + void copy_label (char *, svm_csr_model *) + void copy_probA (char *, svm_csr_model *, np.npy_intp *) + void copy_probB (char *, svm_csr_model *, np.npy_intp *) + np.npy_intp get_l (svm_csr_model *) + np.npy_intp get_nr (svm_csr_model *) + int free_problem (svm_csr_problem *) + int free_model (svm_csr_model *) int free_param (svm_parameter *) - int free_model_SV(svm_model *model) + int free_model_SV(svm_csr_model *model) void set_verbosity(int) @@ -93,8 +93,8 @@ def libsvm_sparse_train ( int n_features, """ cdef svm_parameter *param - cdef svm_problem *problem - cdef svm_model *model + cdef svm_csr_problem *problem + cdef svm_csr_model *model cdef char *error_msg # set libsvm problem @@ -219,7 +219,7 @@ def libsvm_sparse_predict (np.ndarray[np.float64_t, ndim=1, mode='c'] T_data, """ cdef np.ndarray[np.float64_t, ndim=1, mode='c'] dec_values cdef svm_parameter *param - cdef svm_model *model + cdef svm_csr_model *model param = set_parameter(svm_type, kernel_type, degree, gamma, coef0, nu, cache_size, C, eps, p, shrinking, probability, <int> weight.shape[0], weight_label.data, diff --git a/scikits/learn/svm/src/libsvm/libsvm_helper.c b/scikits/learn/svm/src/libsvm/libsvm_helper.c index bc0ab1bffbf6939ab91e2dd816342154e3c1bf46..db9016f1ab693f35dd3fd87976cb42d7823bf3e9 100644 --- a/scikits/learn/svm/src/libsvm/libsvm_helper.c +++ b/scikits/learn/svm/src/libsvm/libsvm_helper.c @@ -122,7 +122,7 @@ struct svm_model *set_model(struct svm_parameter *param, int nr_class, char *probA, char *probB) { struct svm_model *model; - double *dsv_coef = sv_coef; + double *dsv_coef = (double *) sv_coef; int i, m; m = nr_class * (nr_class-1)/2; diff --git a/scikits/learn/svm/src/libsvm/libsvm_sparse_helper.c b/scikits/learn/svm/src/libsvm/libsvm_sparse_helper.c index a4468b450e1cf6b8ecb4d7279f3d5a73bcd05d4f..91605949b7674ccd93dab508e7c7d1278d3521d3 100644 --- a/scikits/learn/svm/src/libsvm/libsvm_sparse_helper.c +++ b/scikits/learn/svm/src/libsvm/libsvm_sparse_helper.c @@ -1,7 +1,6 @@ #include <stdlib.h> #include <numpy/arrayobject.h> -#include "svm_csr.h" - +#include "svm.h" /* @@ -84,20 +83,20 @@ struct svm_csr_problem * csr_set_problem (char *values, npy_intp *n_indices, } -struct svm_model *csr_set_model(struct svm_parameter *param, int nr_class, +struct svm_csr_model *csr_set_model(struct svm_parameter *param, int nr_class, char *SV_data, npy_intp *SV_indices_dims, char *SV_indices, npy_intp *SV_indptr_dims, char *SV_intptr, char *sv_coef, char *rho, char *nSV, char *label, char *probA, char *probB) { - struct svm_model *model; + struct svm_csr_model *model; double *dsv_coef = (double *) sv_coef; int i, m; m = nr_class * (nr_class-1)/2; - model = (struct svm_model *) malloc(sizeof(struct svm_model)); + model = (struct svm_csr_model *) malloc(sizeof(struct svm_csr_model)); model->nSV = (int *) malloc(nr_class * sizeof(int)); model->label = (int *) malloc(nr_class * sizeof(int));; model->sv_coef = (double **) malloc((nr_class-1)*sizeof(double *)); @@ -161,7 +160,7 @@ struct svm_model *csr_set_model(struct svm_parameter *param, int nr_class, */ int csr_copy_SV (char *data, npy_intp *n_indices, char *indices, npy_intp *n_indptr, char *indptr, - struct svm_model *model, int n_features) + struct svm_csr_model *model, int n_features) { int i, j, k=0, index; double *dvalues = (double *) data; @@ -183,7 +182,7 @@ int csr_copy_SV (char *data, npy_intp *n_indices, } /* get number of nonzero coefficients in support vectors */ -npy_intp get_nonzero_SV (struct svm_model *model) { +npy_intp get_nonzero_SV (struct svm_csr_model *model) { int i, j; npy_intp count=0; for (i=0; i<model->l; ++i) { @@ -201,7 +200,7 @@ npy_intp get_nonzero_SV (struct svm_model *model) { * Predict using a model, where data is expected to be enconded into a csr matrix. */ int csr_copy_predict (npy_intp *data_size, char *data, npy_intp *index_size, - char *index, npy_intp *intptr_size, char *intptr, struct svm_model *model, + char *index, npy_intp *intptr_size, char *intptr, struct svm_csr_model *model, char *dec_values) { double *t = (double *) dec_values; struct svm_csr_node **predict_nodes; @@ -221,12 +220,12 @@ int csr_copy_predict (npy_intp *data_size, char *data, npy_intp *index_size, return 0; } -npy_intp get_nr(struct svm_model *model) +npy_intp get_nr(struct svm_csr_model *model) { return (npy_intp) model->nr_class; } -void copy_intercept(char *data, struct svm_model *model, npy_intp *dims) +void copy_intercept(char *data, struct svm_csr_model *model, npy_intp *dims) { /* intercept = -rho */ npy_intp i, n = dims[0]; @@ -245,7 +244,7 @@ void copy_intercept(char *data, struct svm_model *model, npy_intp *dims) * model->sv_coef is a double **, whereas data is just a double *, * so we have to do some stupid copying. */ -void copy_sv_coef(char *data, struct svm_model *model) +void copy_sv_coef(char *data, struct svm_csr_model *model) { int i, len = model->nr_class-1; double *temp = (double *) data; @@ -258,12 +257,12 @@ void copy_sv_coef(char *data, struct svm_model *model) /* * Get the number of support vectors in a model. */ -npy_intp get_l(struct svm_model *model) +npy_intp get_l(struct svm_csr_model *model) { return (npy_intp) model->l; } -void copy_nSV(char *data, struct svm_model *model) +void copy_nSV(char *data, struct svm_csr_model *model) { if (model->label == NULL) return; memcpy(data, model->nSV, model->nr_class * sizeof(int)); @@ -273,18 +272,18 @@ void copy_nSV(char *data, struct svm_model *model) * same as above with model->label * TODO: maybe merge into the previous? */ -void copy_label(char *data, struct svm_model *model) +void copy_label(char *data, struct svm_csr_model *model) { if (model->label == NULL) return; memcpy(data, model->label, model->nr_class * sizeof(int)); } -void copy_probA(char *data, struct svm_model *model, npy_intp * dims) +void copy_probA(char *data, struct svm_csr_model *model, npy_intp * dims) { memcpy(data, model->probA, dims[0] * sizeof(double)); } -void copy_probB(char *data, struct svm_model *model, npy_intp * dims) +void copy_probB(char *data, struct svm_csr_model *model, npy_intp * dims) { memcpy(data, model->probB, dims[0] * sizeof(double)); } @@ -306,7 +305,7 @@ int free_problem(struct svm_csr_problem *problem) return 0; } -int free_model(struct svm_model *model) +int free_model(struct svm_csr_model *model) { /* like svm_free_and_destroy_model, but does not free sv_coef[i] */ if (model == NULL) return -1; @@ -330,7 +329,7 @@ int free_param(struct svm_parameter *param) } -int free_model_SV(struct svm_model *model) +int free_model_SV(struct svm_csr_model *model) { int i; for (i=model->l-1; i>=0; --i) free(model->SV[i]); diff --git a/scikits/learn/svm/src/libsvm/libsvm_template.cpp b/scikits/learn/svm/src/libsvm/libsvm_template.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8f6dbd0dfd9ecd81bdd79c74a19d7299e179389d --- /dev/null +++ b/scikits/learn/svm/src/libsvm/libsvm_template.cpp @@ -0,0 +1,8 @@ + +/* this is a hack to generate libsvm with both sparse and dense + methods in the same binary*/ + +#define _DENSE_REP +#include "svm.cpp" +#undef _DENSE_REP +#include "svm.cpp" diff --git a/scikits/learn/svm/src/libsvm/svm.cpp b/scikits/learn/svm/src/libsvm/svm.cpp index 260e75faac8121730fc3407b724cab12fce81981..185af28276ff3628eadf0fceca0373e9c3ca04c4 100644 --- a/scikits/learn/svm/src/libsvm/svm.cpp +++ b/scikits/learn/svm/src/libsvm/svm.cpp @@ -50,21 +50,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <float.h> #include <string.h> #include <stdarg.h> +#include "svm.h" -/* yeah, this is ugly. It helps us to have unique names for both sparse -and dense versions of this library */ -#ifdef _DENSE_REP - #include "svm.h" - #define PREFIX(name) svm_##name - namespace svm { -#else - #include "svm_csr.h" - #define PREFIX(name) svm_csr_##name - #define svm_node svm_csr_node - #define svm_problem svm_csr_problem - namespace svm_csr { -#endif - +#ifndef _LIBSVM_CPP int libsvm_version = LIBSVM_VERSION; typedef float Qfloat; typedef signed char schar; @@ -114,6 +102,35 @@ static void info(const char *fmt,...) #else static void info(const char *fmt,...) {} #endif +#endif +#define _LIBSVM_CPP + + +/* yeah, this is ugly. It helps us to have unique names for both sparse +and dense versions of this library */ +#ifdef _DENSE_REP + #ifdef PREFIX + #undef PREFIX + #endif + #ifdef NAMESPACE + #undef NAMESPACE + #endif + #define PREFIX(name) svm_##name + #define NAMESPACE svm + namespace svm { +#else + /* sparse representation */ + #ifdef PREFIX + #undef PREFIX + #endif + #ifdef NAMESPACE + #undef NAMESPACE + #endif + #define PREFIX(name) svm_csr_##name + #define NAMESPACE svm_csr + namespace svm_csr { +#endif + // // Kernel Cache @@ -259,13 +276,13 @@ public: class Kernel: public QMatrix { public: #ifdef _DENSE_REP - Kernel(int l, svm_node * x, const svm_parameter& param); + Kernel(int l, PREFIX(node) * x, const svm_parameter& param); #else - Kernel(int l, svm_node * const * x, const svm_parameter& param); + Kernel(int l, PREFIX(node) * const * x, const svm_parameter& param); #endif virtual ~Kernel(); - static double k_function(const svm_node *x, const svm_node *y, + static double k_function(const PREFIX(node) *x, const PREFIX(node) *y, const svm_parameter& param); virtual Qfloat *get_Q(int column, int len) const = 0; virtual double *get_QD() const = 0; @@ -280,9 +297,9 @@ protected: private: #ifdef _DENSE_REP - svm_node *x; + PREFIX(node) *x; #else - const svm_node **x; + const PREFIX(node) **x; #endif double *x_square; @@ -292,9 +309,9 @@ private: const double gamma; const double coef0; - static double dot(const svm_node *px, const svm_node *py); + static double dot(const PREFIX(node) *px, const PREFIX(node) *py); #ifdef _DENSE_REP - static double dot(const svm_node &px, const svm_node &py); + static double dot(const PREFIX(node) &px, const PREFIX(node) &py); #endif double kernel_linear(int i, int j) const @@ -324,9 +341,9 @@ private: }; #ifdef _DENSE_REP -Kernel::Kernel(int l, svm_node * x_, const svm_parameter& param) +Kernel::Kernel(int l, PREFIX(node) * x_, const svm_parameter& param) #else -Kernel::Kernel(int l, svm_node * const * x_, const svm_parameter& param) +Kernel::Kernel(int l, PREFIX(node) * const * x_, const svm_parameter& param) #endif :kernel_type(param.kernel_type), degree(param.degree), gamma(param.gamma), coef0(param.coef0) @@ -369,7 +386,7 @@ Kernel::~Kernel() } #ifdef _DENSE_REP -double Kernel::dot(const svm_node *px, const svm_node *py) +double Kernel::dot(const PREFIX(node) *px, const PREFIX(node) *py) { double sum = 0; @@ -379,7 +396,7 @@ double Kernel::dot(const svm_node *px, const svm_node *py) return sum; } -double Kernel::dot(const svm_node &px, const svm_node &py) +double Kernel::dot(const PREFIX(node) &px, const PREFIX(node) &py) { double sum = 0; @@ -389,7 +406,7 @@ double Kernel::dot(const svm_node &px, const svm_node &py) return sum; } #else -double Kernel::dot(const svm_node *px, const svm_node *py) +double Kernel::dot(const PREFIX(node) *px, const PREFIX(node) *py) { double sum = 0; while(px->index != -1 && py->index != -1) @@ -412,7 +429,7 @@ double Kernel::dot(const svm_node *px, const svm_node *py) } #endif -double Kernel::k_function(const svm_node *x, const svm_node *y, +double Kernel::k_function(const PREFIX(node) *x, const PREFIX(node) *y, const svm_parameter& param) { switch(param.kernel_type) @@ -1370,7 +1387,7 @@ double Solver_NU::calculate_rho() class SVC_Q: public Kernel { public: - SVC_Q(const svm_problem& prob, const svm_parameter& param, const schar *y_) + SVC_Q(const PREFIX(problem)& prob, const svm_parameter& param, const schar *y_) :Kernel(prob.l, prob.x, param) { clone(y,y_,prob.l); @@ -1420,7 +1437,7 @@ private: class ONE_CLASS_Q: public Kernel { public: - ONE_CLASS_Q(const svm_problem& prob, const svm_parameter& param) + ONE_CLASS_Q(const PREFIX(problem)& prob, const svm_parameter& param) :Kernel(prob.l, prob.x, param) { cache = new Cache(prob.l,(long int)(param.cache_size*(1<<20))); @@ -1466,7 +1483,7 @@ private: class SVR_Q: public Kernel { public: - SVR_Q(const svm_problem& prob, const svm_parameter& param) + SVR_Q(const PREFIX(problem)& prob, const svm_parameter& param) :Kernel(prob.l, prob.x, param) { l = prob.l; @@ -1542,7 +1559,7 @@ private: // construct and solve various formulations // static void solve_c_svc( - const svm_problem *prob, const svm_parameter* param, + const PREFIX(problem) *prob, const svm_parameter* param, double *alpha, Solver::SolutionInfo* si, double Cp, double Cn) { int l = prob->l; @@ -1577,7 +1594,7 @@ static void solve_c_svc( } static void solve_nu_svc( - const svm_problem *prob, const svm_parameter *param, + const PREFIX(problem) *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo* si) { int i; @@ -1632,7 +1649,7 @@ static void solve_nu_svc( } static void solve_one_class( - const svm_problem *prob, const svm_parameter *param, + const PREFIX(problem) *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo* si) { int l = prob->l; @@ -1664,7 +1681,7 @@ static void solve_one_class( } static void solve_epsilon_svr( - const svm_problem *prob, const svm_parameter *param, + const PREFIX(problem) *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo* si) { int l = prob->l; @@ -1702,7 +1719,7 @@ static void solve_epsilon_svr( } static void solve_nu_svr( - const svm_problem *prob, const svm_parameter *param, + const PREFIX(problem) *prob, const svm_parameter *param, double *alpha, Solver::SolutionInfo* si) { int l = prob->l; @@ -1749,7 +1766,7 @@ struct decision_function }; static decision_function svm_train_one( - const svm_problem *prob, const svm_parameter *param, + const PREFIX(problem) *prob, const svm_parameter *param, double Cp, double Cn) { double *alpha = Malloc(double,prob->l); @@ -1994,7 +2011,7 @@ static void multiclass_probability(int k, double **r, double *p) // Cross-validation decision values for probability estimates static void svm_binary_svc_probability( - const svm_problem *prob, const svm_parameter *param, + const PREFIX(problem) *prob, const svm_parameter *param, double Cp, double Cn, double& probA, double& probB) { int i; @@ -2014,13 +2031,13 @@ static void svm_binary_svc_probability( int begin = i*prob->l/nr_fold; int end = (i+1)*prob->l/nr_fold; int j,k; - struct svm_problem subprob; + struct PREFIX(problem) subprob; subprob.l = prob->l-(end-begin); #ifdef _DENSE_REP - subprob.x = Malloc(struct svm_node,subprob.l); + subprob.x = Malloc(struct PREFIX(node),subprob.l); #else - subprob.x = Malloc(struct svm_node*,subprob.l); + subprob.x = Malloc(struct PREFIX(node)*,subprob.l); #endif subprob.y = Malloc(double,subprob.l); @@ -2065,7 +2082,7 @@ static void svm_binary_svc_probability( subparam.weight_label[1]=-1; subparam.weight[0]=Cp; subparam.weight[1]=Cn; - struct svm_model *submodel = PREFIX(train)(&subprob,&subparam); + struct PREFIX(model) *submodel = PREFIX(train)(&subprob,&subparam); for(j=begin;j<end;j++) { #ifdef _DENSE_REP @@ -2089,7 +2106,7 @@ static void svm_binary_svc_probability( // Return parameter of a Laplace distribution static double svm_svr_probability( - const svm_problem *prob, const svm_parameter *param) + const PREFIX(problem) *prob, const svm_parameter *param) { int i; int nr_fold = 5; @@ -2122,7 +2139,7 @@ static double svm_svr_probability( // label: label name, start: begin of each class, count: #data of classes, perm: indices to the original data // perm, length l, must be allocated before calling this subroutine -static void svm_group_classes(const svm_problem *prob, int *nr_class_ret, int **label_ret, int **start_ret, int **count_ret, int *perm) +static void svm_group_classes(const PREFIX(problem) *prob, int *nr_class_ret, int **label_ret, int **start_ret, int **count_ret, int *perm) { int l = prob->l; int max_nr_class = 16; @@ -2180,17 +2197,13 @@ static void svm_group_classes(const svm_problem *prob, int *nr_class_ret, int ** } } /* end namespace */ -#ifdef _DENSE_REP -using namespace svm; -#else -using namespace svm_csr; -#endif + // // Interface functions // -svm_model *PREFIX(train)(const svm_problem *prob, const svm_parameter *param) +PREFIX(model) *PREFIX(train)(const PREFIX(problem) *prob, const svm_parameter *param) { - svm_model *model = Malloc(svm_model,1); + PREFIX(model) *model = Malloc(PREFIX(model),1); model->param = *param; model->free_sv = 0; // XXX @@ -2210,10 +2223,10 @@ svm_model *PREFIX(train)(const svm_problem *prob, const svm_parameter *param) param->svm_type == NU_SVR)) { model->probA = Malloc(double,1); - model->probA[0] = svm_svr_probability(prob,param); + model->probA[0] = NAMESPACE::svm_svr_probability(prob,param); } - decision_function f = svm_train_one(prob,param,0,0); + NAMESPACE::decision_function f = NAMESPACE::svm_train_one(prob,param,0,0); model->rho = Malloc(double,1); model->rho[0] = f.rho; @@ -2223,9 +2236,9 @@ svm_model *PREFIX(train)(const svm_problem *prob, const svm_parameter *param) if(fabs(f.alpha[i]) > 0) ++nSV; model->l = nSV; #ifdef _DENSE_REP - model->SV = Malloc(svm_node,nSV); + model->SV = Malloc(PREFIX(node),nSV); #else - model->SV = Malloc(svm_node *,nSV); + model->SV = Malloc(PREFIX(node) *,nSV); #endif model->sv_ind = Malloc(int, nSV); model->sv_coef[0] = Malloc(double, nSV); @@ -2252,11 +2265,11 @@ svm_model *PREFIX(train)(const svm_problem *prob, const svm_parameter *param) int *perm = Malloc(int,l); // group training data of the same class - svm_group_classes(prob,&nr_class,&label,&start,&count,perm); + NAMESPACE::svm_group_classes(prob,&nr_class,&label,&start,&count,perm); #ifdef _DENSE_REP - svm_node *x = Malloc(svm_node,l); + PREFIX(node) *x = Malloc(PREFIX(node),l); #else - svm_node **x = Malloc(svm_node *,l); + PREFIX(node) **x = Malloc(PREFIX(node) *,l); #endif int i; for(i=0;i<l;i++) @@ -2284,7 +2297,7 @@ svm_model *PREFIX(train)(const svm_problem *prob, const svm_parameter *param) bool *nonzero = Malloc(bool,l); for(i=0;i<l;i++) nonzero[i] = false; - decision_function *f = Malloc(decision_function,nr_class*(nr_class-1)/2); + NAMESPACE::decision_function *f = Malloc(NAMESPACE::decision_function,nr_class*(nr_class-1)/2); double *probA=NULL,*probB=NULL; if (param->probability) @@ -2297,14 +2310,14 @@ svm_model *PREFIX(train)(const svm_problem *prob, const svm_parameter *param) for(i=0;i<nr_class;i++) for(int j=i+1;j<nr_class;j++) { - svm_problem sub_prob; + PREFIX(problem) sub_prob; int si = start[i], sj = start[j]; int ci = count[i], cj = count[j]; sub_prob.l = ci+cj; #ifdef _DENSE_REP - sub_prob.x = Malloc(svm_node,sub_prob.l); + sub_prob.x = Malloc(PREFIX(node),sub_prob.l); #else - sub_prob.x = Malloc(svm_node *,sub_prob.l); + sub_prob.x = Malloc(PREFIX(node) *,sub_prob.l); #endif sub_prob.y = Malloc(double,sub_prob.l); int k; @@ -2320,9 +2333,9 @@ svm_model *PREFIX(train)(const svm_problem *prob, const svm_parameter *param) } if(param->probability) - svm_binary_svc_probability(&sub_prob,param,weighted_C[i],weighted_C[j],probA[p],probB[p]); + NAMESPACE::svm_binary_svc_probability(&sub_prob,param,weighted_C[i],weighted_C[j],probA[p],probB[p]); - f[p] = svm_train_one(&sub_prob,param,weighted_C[i],weighted_C[j]); + f[p] = NAMESPACE::svm_train_one(&sub_prob,param,weighted_C[i],weighted_C[j]); for(k=0;k<ci;k++) if(!nonzero[si+k] && fabs(f[p].alpha[k]) > 0) nonzero[si+k] = true; @@ -2378,14 +2391,14 @@ svm_model *PREFIX(train)(const svm_problem *prob, const svm_parameter *param) nz_count[i] = nSV; } - info("Total nSV = %d\n",total_sv); + info("Total nSV = %d\n",total_sv); model->l = total_sv; model->sv_ind = Malloc(int, total_sv); #ifdef _DENSE_REP - model->SV = Malloc(svm_node,total_sv); + model->SV = Malloc(PREFIX(node),total_sv); #else - model->SV = Malloc(svm_node *,total_sv); + model->SV = Malloc(PREFIX(node) *,total_sv); #endif p = 0; for(i=0;i<l;i++) { @@ -2449,7 +2462,7 @@ svm_model *PREFIX(train)(const svm_problem *prob, const svm_parameter *param) } // Stratified cross validation -void PREFIX(cross_validation)(const svm_problem *prob, const svm_parameter *param, int nr_fold, double *target) +void PREFIX(cross_validation)(const PREFIX(problem) *prob, const svm_parameter *param, int nr_fold, double *target) { int i; int *fold_start = Malloc(int,nr_fold+1); @@ -2465,7 +2478,7 @@ void PREFIX(cross_validation)(const svm_problem *prob, const svm_parameter *para int *start = NULL; int *label = NULL; int *count = NULL; - svm_group_classes(prob,&nr_class,&label,&start,&count,perm); + NAMESPACE::svm_group_classes(prob,&nr_class,&label,&start,&count,perm); // random shuffle and then data grouped by fold using the array perm int *fold_count = Malloc(int,nr_fold); @@ -2525,13 +2538,13 @@ void PREFIX(cross_validation)(const svm_problem *prob, const svm_parameter *para int begin = fold_start[i]; int end = fold_start[i+1]; int j,k; - struct svm_problem subprob; + struct PREFIX(problem) subprob; subprob.l = l-(end-begin); #ifdef _DENSE_REP - subprob.x = Malloc(struct svm_node,subprob.l); + subprob.x = Malloc(struct PREFIX(node),subprob.l); #else - subprob.x = Malloc(struct svm_node*,subprob.l); + subprob.x = Malloc(struct PREFIX(node)*,subprob.l); #endif subprob.y = Malloc(double,subprob.l); @@ -2548,7 +2561,7 @@ void PREFIX(cross_validation)(const svm_problem *prob, const svm_parameter *para subprob.y[k] = prob->y[perm[j]]; ++k; } - struct svm_model *submodel = PREFIX(train)(&subprob,param); + struct PREFIX(model) *submodel = PREFIX(train)(&subprob,param); if(param->probability && (param->svm_type == C_SVC || param->svm_type == NU_SVC)) { @@ -2577,24 +2590,24 @@ void PREFIX(cross_validation)(const svm_problem *prob, const svm_parameter *para } -int PREFIX(get_svm_type)(const svm_model *model) +int PREFIX(get_svm_type)(const PREFIX(model) *model) { return model->param.svm_type; } -int PREFIX(get_nr_class)(const svm_model *model) +int PREFIX(get_nr_class)(const PREFIX(model) *model) { return model->nr_class; } -void PREFIX(get_labels)(const svm_model *model, int* label) +void PREFIX(get_labels)(const PREFIX(model) *model, int* label) { if (model->label != NULL) for(int i=0;i<model->nr_class;i++) label[i] = model->label[i]; } -double PREFIX(get_svr_probability)(const svm_model *model) +double PREFIX(get_svr_probability)(const PREFIX(model) *model) { if ((model->param.svm_type == EPSILON_SVR || model->param.svm_type == NU_SVR) && model->probA!=NULL) @@ -2606,7 +2619,7 @@ double PREFIX(get_svr_probability)(const svm_model *model) } } -double PREFIX(predict_values)(const svm_model *model, const svm_node *x, double* dec_values) +double PREFIX(predict_values)(const PREFIX(model) *model, const PREFIX(node) *x, double* dec_values) { int i; if(model->param.svm_type == ONE_CLASS || @@ -2619,9 +2632,9 @@ double PREFIX(predict_values)(const svm_model *model, const svm_node *x, double* for(i=0;i<model->l;i++) #ifdef _DENSE_REP - sum += sv_coef[i] * Kernel::k_function(x,model->SV+i,model->param); + sum += sv_coef[i] * NAMESPACE::Kernel::k_function(x,model->SV+i,model->param); #else - sum += sv_coef[i] * Kernel::k_function(x,model->SV[i],model->param); + sum += sv_coef[i] * NAMESPACE::Kernel::k_function(x,model->SV[i],model->param); #endif sum -= model->rho[0]; *dec_values = sum; @@ -2640,9 +2653,9 @@ double PREFIX(predict_values)(const svm_model *model, const svm_node *x, double* double *kvalue = Malloc(double,l); for(i=0;i<l;i++) #ifdef _DENSE_REP - kvalue[i] = Kernel::k_function(x,model->SV+i,model->param); + kvalue[i] = NAMESPACE::Kernel::k_function(x,model->SV+i,model->param); #else - kvalue[i] = Kernel::k_function(x,model->SV[i],model->param); + kvalue[i] = NAMESPACE::Kernel::k_function(x,model->SV[i],model->param); #endif int *start = Malloc(int,nr_class); @@ -2693,7 +2706,7 @@ double PREFIX(predict_values)(const svm_model *model, const svm_node *x, double* } } -double PREFIX(predict)(const svm_model *model, const svm_node *x) +double PREFIX(predict)(const PREFIX(model) *model, const PREFIX(node) *x) { int nr_class = model->nr_class; double *dec_values; @@ -2709,7 +2722,7 @@ double PREFIX(predict)(const svm_model *model, const svm_node *x) } double PREFIX(predict_probability)( - const svm_model *model, const svm_node *x, double *prob_estimates) + const PREFIX(model) *model, const PREFIX(node) *x, double *prob_estimates) { if ((model->param.svm_type == C_SVC || model->param.svm_type == NU_SVC) && model->probA!=NULL && model->probB!=NULL) @@ -2727,11 +2740,11 @@ double PREFIX(predict_probability)( for(i=0;i<nr_class;i++) for(int j=i+1;j<nr_class;j++) { - pairwise_prob[i][j]=min(max(sigmoid_predict(dec_values[k],model->probA[k],model->probB[k]),min_prob),1-min_prob); + pairwise_prob[i][j]=min(max(NAMESPACE::sigmoid_predict(dec_values[k],model->probA[k],model->probB[k]),min_prob),1-min_prob); pairwise_prob[j][i]=1-pairwise_prob[i][j]; k++; } - multiclass_probability(nr_class,pairwise_prob,prob_estimates); + NAMESPACE::multiclass_probability(nr_class,pairwise_prob,prob_estimates); int prob_max_idx = 0; for(i=1;i<nr_class;i++) @@ -2747,17 +2760,8 @@ double PREFIX(predict_probability)( return PREFIX(predict)(model, x); } -static const char *svm_type_table[] = -{ - "c_svc","nu_svc","one_class","epsilon_svr","nu_svr",NULL -}; - -static const char *kernel_type_table[]= -{ - "linear","polynomial","rbf","sigmoid","precomputed",NULL -}; -void PREFIX(free_model_content)(svm_model* model_ptr) +void PREFIX(free_model_content)(PREFIX(model)* model_ptr) { if(model_ptr->free_sv && model_ptr->l > 0) #ifdef _DENSE_REP @@ -2778,9 +2782,9 @@ void PREFIX(free_model_content)(svm_model* model_ptr) free(model_ptr->nSV); } -void PREFIX(free_and_destroy_model)(svm_model** model_ptr_ptr) +void PREFIX(free_and_destroy_model)(PREFIX(model)** model_ptr_ptr) { - svm_model* model_ptr = *model_ptr_ptr; + PREFIX(model)* model_ptr = *model_ptr_ptr; if(model_ptr != NULL) { PREFIX(free_model_content)(model_ptr); @@ -2788,9 +2792,9 @@ void PREFIX(free_and_destroy_model)(svm_model** model_ptr_ptr) } } -void PREFIX(destroy_model)(svm_model* model_ptr) +void PREFIX(destroy_model)(PREFIX(model)* model_ptr) { - fprintf(stderr,"warning: svm_destroy_model is deprecated and should not be used. Please use svm_free_and_destroy_model(svm_model **model_ptr_ptr)\n"); + fprintf(stderr,"warning: svm_destroy_model is deprecated and should not be used. Please use svm_free_and_destroy_model(PREFIX(model) **model_ptr_ptr)\n"); PREFIX(free_and_destroy_model)(&model_ptr); } @@ -2800,7 +2804,7 @@ void PREFIX(destroy_param)(svm_parameter* param) free(param->weight); } -const char *PREFIX(check_parameter)(const svm_problem *prob, const svm_parameter *param) +const char *PREFIX(check_parameter)(const PREFIX(problem) *prob, const svm_parameter *param) { // svm_type @@ -2921,7 +2925,7 @@ const char *PREFIX(check_parameter)(const svm_problem *prob, const svm_parameter return NULL; } -int PREFIX(check_probability_model)(const svm_model *model) +int PREFIX(check_probability_model)(const PREFIX(model) *model) { return ((model->param.svm_type == C_SVC || model->param.svm_type == NU_SVC) && model->probA!=NULL && model->probB!=NULL) || @@ -2929,7 +2933,7 @@ int PREFIX(check_probability_model)(const svm_model *model) model->probA!=NULL); } -void svm_set_print_string_function(void (*print_func)(const char *)) +void PREFIX(set_print_string_function)(void (*print_func)(const char *)) { if(print_func == NULL) svm_print_string = &print_string_stdout; diff --git a/scikits/learn/svm/src/libsvm/svm.h b/scikits/learn/svm/src/libsvm/svm.h index 66893a65e0a68e846cd70702b81ad870f949e9f8..27726a1689e0d5bf68be8bb654d309e51f814a28 100644 --- a/scikits/learn/svm/src/libsvm/svm.h +++ b/scikits/learn/svm/src/libsvm/svm.h @@ -9,7 +9,6 @@ extern "C" { extern int libsvm_version; -#ifdef _DENSE_REP struct svm_node { int dim; @@ -25,20 +24,20 @@ struct svm_problem struct svm_node *x; }; -#else -struct svm_node + +struct svm_csr_node { int index; double value; }; -struct svm_problem +struct svm_csr_problem { int l; double *y; - struct svm_node **x; + struct svm_csr_node **x; }; -#endif + enum { C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR }; /* svm_type */ enum { LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED }; /* kernel_type */ @@ -72,11 +71,7 @@ struct svm_model struct svm_parameter param; /* parameter */ int nr_class; /* number of classes, = 2 in regression/one class svm */ int l; /* total #SV */ -#ifdef _DENSE_REP struct svm_node *SV; /* SVs (SV[l]) */ -#else - struct svm_node **SV; /* SVs (SV[l]) */ -#endif double **sv_coef; /* coefficients for SVs in decision functions (sv_coef[k-1][l]) */ int *sv_ind; /* index of support vectors */ @@ -95,6 +90,32 @@ struct svm_model /* 0 if svm_model is created by svm_train */ }; + +struct svm_csr_model +{ + struct svm_parameter param; /* parameter */ + int nr_class; /* number of classes, = 2 in regression/one class svm */ + int l; /* total #SV */ + struct svm_csr_node **SV; /* SVs (SV[l]) */ + double **sv_coef; /* coefficients for SVs in decision functions (sv_coef[k-1][l]) */ + + int *sv_ind; /* index of support vectors */ + + double *rho; /* constants in decision functions (rho[k*(k-1)/2]) */ + double *probA; /* pariwise probability information */ + double *probB; + + /* for classification only */ + + int *label; /* label of each class (label[k]) */ + int *nSV; /* number of SVs for each class (nSV[k]) */ + /* nSV[0] + nSV[1] + ... + nSV[k-1] = l */ + /* XXX */ + int free_sv; /* 1 if svm_model is created by svm_load_model*/ + /* 0 if svm_model is created by svm_train */ +}; + + struct svm_model *svm_train(const struct svm_problem *prob, const struct svm_parameter *param); void svm_cross_validation(const struct svm_problem *prob, const struct svm_parameter *param, int nr_fold, double *target); @@ -123,6 +144,31 @@ void svm_set_print_string_function(void (*print_func)(const char *)); // this function will be removed in future release void svm_destroy_model(struct svm_model *model_ptr); + +/* sparse version */ + +struct svm_csr_model *svm_csr_train(const struct svm_csr_problem *prob, const struct svm_parameter *param); +void svm_csr_cross_validation(const struct svm_csr_problem *prob, const struct svm_parameter *param, int nr_fold, double *target); + +int svm_csr_get_svm_type(const struct svm_csr_model *model); +int svm_csr_get_nr_class(const struct svm_csr_model *model); +void svm_csr_get_labels(const struct svm_csr_model *model, int *label); +double svm_csr_get_svr_probability(const struct svm_csr_model *model); + +double svm_csr_predict_values(const struct svm_csr_model *model, const struct svm_csr_node *x, double* dec_values); +double svm_csr_predict(const struct svm_csr_model *model, const struct svm_csr_node *x); +double svm_csr_predict_probability(const struct svm_csr_model *model, const struct svm_csr_node *x, double* prob_estimates); + +void svm_csr_free_model_content(struct svm_csr_model *model_ptr); +void svm_csr_free_and_destroy_model(struct svm_csr_model **model_ptr_ptr); +void svm_csr_destroy_param(struct svm_parameter *param); + +const char *svm_csr_check_parameter(const struct svm_csr_problem *prob, const struct svm_parameter *param); +int svm_csr_check_probability_model(const struct svm_csr_model *model); + +/* end sparse version */ + + #ifdef __cplusplus } #endif diff --git a/scikits/learn/svm/src/libsvm/svm_csr.h b/scikits/learn/svm/src/libsvm/svm_csr.h deleted file mode 100644 index 0e116d49a8acb481e7ae8bb2e4e9afda05665193..0000000000000000000000000000000000000000 --- a/scikits/learn/svm/src/libsvm/svm_csr.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef _LIBSVM_H -#define _LIBSVM_H - -#define LIBSVM_VERSION 300 - -#ifdef __cplusplus -extern "C" { -#endif - -extern int libsvm_version; - -struct svm_csr_node -{ - int index; - double value; -}; - -struct svm_csr_problem -{ - int l; - double *y; - struct svm_csr_node **x; -}; - -enum { C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR }; /* svm_type */ -enum { LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED }; /* kernel_type */ - -struct svm_parameter -{ - int svm_type; - int kernel_type; - int degree; /* for poly */ - double gamma; /* for poly/rbf/sigmoid */ - double coef0; /* for poly/sigmoid */ - - /* these are for training only */ - double cache_size; /* in MB */ - double eps; /* stopping criteria */ - double C; /* for C_SVC, EPSILON_SVR and NU_SVR */ - int nr_weight; /* for C_SVC */ - int *weight_label; /* for C_SVC */ - double* weight; /* for C_SVC */ - double nu; /* for NU_SVC, ONE_CLASS, and NU_SVR */ - double p; /* for EPSILON_SVR */ - int shrinking; /* use the shrinking heuristics */ - int probability; /* do probability estimates */ -}; - -// -// svm_model -// -struct svm_model -{ - struct svm_parameter param; /* parameter */ - int nr_class; /* number of classes, = 2 in regression/one class svm */ - int l; /* total #SV */ - struct svm_csr_node **SV; /* SVs (SV[l]) */ - double **sv_coef; /* coefficients for SVs in decision functions (sv_coef[k-1][l]) */ - - int *sv_ind; /* index of support vectors */ - - double *rho; /* constants in decision functions (rho[k*(k-1)/2]) */ - double *probA; /* pariwise probability information */ - double *probB; - - /* for classification only */ - - int *label; /* label of each class (label[k]) */ - int *nSV; /* number of SVs for each class (nSV[k]) */ - /* nSV[0] + nSV[1] + ... + nSV[k-1] = l */ - /* XXX */ - int free_sv; /* 1 if svm_model is created by svm_load_model*/ - /* 0 if svm_model is created by svm_train */ -}; - -struct svm_model *svm_csr_train(const struct svm_csr_problem *prob, const struct svm_parameter *param); -void svm_csr_cross_validation(const struct svm_csr_problem *prob, const struct svm_parameter *param, int nr_fold, double *target); - -int svm_csr_get_svm_type(const struct svm_model *model); -int svm_csr_get_nr_class(const struct svm_model *model); -void svm_csr_get_labels(const struct svm_model *model, int *label); -double svm_csr_get_svr_probability(const struct svm_model *model); - -double svm_csr_predict_values(const struct svm_model *model, const struct svm_csr_node *x, double* dec_values); -double svm_csr_predict(const struct svm_model *model, const struct svm_csr_node *x); -double svm_csr_predict_probability(const struct svm_model *model, const struct svm_csr_node *x, double* prob_estimates); - -void svm_csr_free_model_content(struct svm_model *model_ptr); -void svm_csr_free_and_destroy_model(struct svm_model **model_ptr_ptr); -void svm_csr_destroy_param(struct svm_parameter *param); - -const char *svm_csr_check_parameter(const struct svm_csr_problem *prob, const struct svm_parameter *param); -int svm_csr_check_probability_model(const struct svm_model *model); - -void svm_set_print_string_function(void (*print_func)(const char *)); - -#ifdef __cplusplus -} -#endif - -#endif /* _LIBSVM_H */