8000 cosmit: more detailed doc string for why fortran style arrays · seckcoder/scikit-learn@4ddf69e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ddf69e

Browse files
committed
cosmit: more detailed doc string for why fortran style arrays
1 parent 9a98f73 commit 4ddf69e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sklearn/linear_model/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,12 @@ def _validate_sample_weight(self, sample_weight, n_samples):
249249
return sample_weight
250250

251251
def _set_coef(self, coef_):
252-
"""Make sure that coef_ is fortran-style and 2d. """
252+
"""Make sure that coef_ is fortran-style and 2d.
253+
254+
Fortran-style memory layout is needed to ensure that computing
255+
the dot product between input ``X`` and ``coef_`` does not trigger
256+
a memory copy.
257+
"""
253258
self.coef_ = np.asfortranarray(array2d(coef_))
254259

255260
def _allocate_parameter_mem(self, n_classes, n_features, coef_init=None,

0 commit comments

Comments
 (0)
0