Commits

Lan Zagar  committed 8f3d85d

Extract weights from LibLinearLogRegLearner.

  • Participants
  • Parent commits 2d04b46

Comments (0)

Files changed (1)

File _multitask/mtfeat.py

         weightsa = Orange.classification.svm.get_linear_svm_weights(c)
         weights = [wd[f] for f in c.domain]
     elif isinstance(c, Orange.classification.svm.LinearClassifier):
-        #intercept is the last weight (check by Ales)!
-        weights = c.weights[0][:-1]
+        assert len(c.weights) == 1
+        # logreg.LibLinearLogRegLearner
+        weights = c.weights[0]
+        if len(c.domain.features) != len(weights):
+            # svm.LinearSVMLearner
+            #intercept is the last weight (check by Ales)!
+            weights = weights[:-1]
         assert len(c.domain.features) == len(weights)
     else:
         weights = array(c.coefficients)