@@ -1475,17 +1475,21 @@ def transform(self, X):
1475
1475
1476
1476
Parameters
1477
1477
----------
1478
- X : array-like or sparse matrix, shape [n_samples, n_features]
1478
+ X : array-like or CSR/CSC sparse matrix, shape [n_samples, n_features]
1479
1479
The data to transform, row by row.
1480
- Sparse input should preferably be in CSR format (for speed),
1481
- but must be in CSC format if the degree is 4 or higher.
1482
-
1483
- If the input matrix is in CSR format and the expansion is of
1484
- degree 2 or 3, the method described in the work "Leveraging
1485
- Sparsity to Speed Up Polynomial Feature Expansions of CSR
1486
- Matrices Using K-Simplex Numbers" by Andrew Nystrom and
1487
- John Hughes is used, which is much faster than the method
1488
- used on CSC input.
1480
+
1481
+ Prefer CSR over CSC for sparse input (for speed), but CSC is
1482
+ required if the degree is 4 or higher. If the degree is less than
1483
+ 4 and the input format is CSC, it will be converted to CSR, have
1484
+ its polynomial features generated, then converted back to CSC.
1485
+
1486
+ If the degree is 2 or 3, the method described in "Leveraging
1487
+ Sparsity to Speed Up Polynomial Feature Expansions of CSR Matrices
1488
+ Using K-Simplex Numbers" by Andrew Nystrom and John Hughes is
1489
+ used, which is much faster than the method used on CSC input. For
1490
+ this reason, a CSC input will be converted to CSR, and the output
1491
+ will be converted back to CSC prior to being returned, hence the
1492
+ preference of CSR.
1489
1493
1490
1494
Returns
1491
1495
-------
0 commit comments