Skip to content

Commit aea0247

Browse files
committed
Allow large thresholds to promote sparsity
1 parent 9fe17c0 commit aea0247

File tree

1 file changed

+7
-1
lines changed
  • mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed

1 file changed

+7
-1
lines changed

mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/RowMatrix.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,13 @@ class RowMatrix(
455455
* between columns of this matrix.
456456
*/
457457
def columnSimilarities(threshold: Double): CoordinateMatrix = {
458-
require(threshold >= 0 && threshold <= 1, s"Threshold not in [0,1]: $threshold")
458+
require(threshold >= 0, s"Threshold cannot be negative: $threshold")
459+
460+
if (threshold > 1) {
461+
logWarning(s"Threshold is greater than 1: $threshold " +
462+
"Computation will be more efficient with promoted sparsity, " +
463+
" however there is no correctness guarantee.")
464+
}
459465

460466
val gamma = if (threshold < 1e-6) {
461467
Double.PositiveInfinity

0 commit comments

Comments
 (0)