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

TypeError in Pyspark Linear Regression docs

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1.1
    • Fix Version/s: 3.1.2, 3.2.0
    • Component/s: Documentation, ML, PySpark
    • Labels:
      None

      Description

      The documentation for Linear Regression in Pyspark includes an example, which contains a TypeError:

      https://spark.apache.org/docs/latest/api/python/reference/api/pyspark.ml.regression.LinearRegression.html?highlight=linearregression#pyspark.ml.regression.LinearRegression

      >>> abs(model.transform(test1).head().newPrediction - 1.0) < 0.001
      True
      >>> lr.setParams("vector")
      Traceback (most recent call last):
          ...
      TypeError: Method setParams forces keyword arguments.
      

      I'm pretty sure we don't intend this, and it can be resolved by just changing the function call to use keyword args.

      (HT Brooke Wenig for flagging this)

        Attachments

          Activity

            People

            • Assignee:
              srowen Sean R. Owen
              Reporter:
              srowen Sean R. Owen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: