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

TypeError in Pyspark Linear Regression docs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.1.1
    • 3.1.2, 3.2.0
    • Documentation, ML, PySpark
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: