# HG changeset patch
# User Lan Zagar
# Date 1349698643 -7200
# Node ID 8f3d85db398c564f0142cd59aa05aa78848c7cc4
# Parent 2d04b46b46d98510373016c94088b502619ebfe9
Extract weights from LibLinearLogRegLearner.
diff --git a/_multitask/mtfeat.py b/_multitask/mtfeat.py
--- a/_multitask/mtfeat.py
+++ b/_multitask/mtfeat.py
@@ -20,8 +20,13 @@
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)