Skip to content

Commit 5fcf6f4

Browse files
amuellerogrisel
authored andcommitted
hotfix for LinearSVR non-writable y segfault (scikit-learn#11133)
1 parent b4984e2 commit 5fcf6f4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sklearn/svm/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ def _fit_liblinear(X, y, C, fit_intercept, intercept_scaling, class_weight,
766766
random_state=None, multi_class='ovr',
767767
loss='logistic_regression', epsilon=0.1,
768768
sample_weight=None):
769-
"""Used by Logistic Regression (and CV) and LinearSVC.
769+
"""Used by Logistic Regression (and CV) and LinearSVC/LinearSVR.
770770
771771
Preprocessing is done in this function before supplying it to liblinear.
772772
@@ -891,6 +891,7 @@ def _fit_liblinear(X, y, C, fit_intercept, intercept_scaling, class_weight,
891891

892892
# LibLinear wants targets as doubles, even for classification
893893
y_ind = np.asarray(y_ind, dtype=np.float64).ravel()
894+
y_ind = np.require(y_ind, requirements="W")
894895
if sample_weight is None:
895896
sample_weight = np.ones(X.shape[0])
896897
else:

0 commit comments

Comments
 (0)