Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-11918

Better error from WLS for cases like singular input

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: ML
    • Labels:
      None

      Description

      Weighted Least Squares (WLS) is one of the optimization method for solve Linear Regression (when #feature < 4096). But if the dataset is very ill condition (such as 0-1 based label used for classification and the equation is underdetermined), the WLS failed (But "l-bfgs" can train and get the model). The failure is caused by the underneath lapack library return error value when Cholesky decomposition.
      This issue is easy to reproduce, you can train a LinearRegressionModel by "normal" solver with the example dataset(https://github.com/apache/spark/blob/master/data/mllib/sample_libsvm_data.txt). The following is the exception:

      assertion failed: lapack.dpotrs returned 1.
      java.lang.AssertionError: assertion failed: lapack.dpotrs returned 1.
      	at scala.Predef$.assert(Predef.scala:179)
      	at org.apache.spark.mllib.linalg.CholeskyDecomposition$.solve(CholeskyDecomposition.scala:42)
      	at org.apache.spark.ml.optim.WeightedLeastSquares.fit(WeightedLeastSquares.scala:117)
      	at org.apache.spark.ml.regression.LinearRegression.train(LinearRegression.scala:180)
      	at org.apache.spark.ml.regression.LinearRegression.train(LinearRegression.scala:67)
      	at org.apache.spark.ml.Predictor.fit(Predictor.scala:90)
      

        Attachments

        1. R_GLM_output
          53 kB
          Yanbo Liang

          Issue Links

            Activity

              People

              • Assignee:
                srowen Sean Owen
                Reporter:
                yanboliang Yanbo Liang
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: