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

ml.recommendation.ALS doctests failures

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.3.0
    • 3.3.0
    • ML, PySpark
    • None

    Description

      In my dev setups, ml.recommendation:ALS test consistently converges to value lower than expected and fails with:

      File "/path/to/spark/python/pyspark/ml/recommendation.py", line 322, in __main__.ALS
      Failed example:
          predictions[0]
      Expected:
          Row(user=0, item=2, newPrediction=0.69291...)
      Got:
          Row(user=0, item=2, newPrediction=0.6929099559783936)
      

      In can correct for that, but it creates some noise, so if anyone else experiences this, we could drop a digit from the results

      diff --git a/python/pyspark/ml/recommendation.py b/python/pyspark/ml/recommendation.py
      index f0628fb922..b8e2a6097d 100644
      --- a/python/pyspark/ml/recommendation.py
      +++ b/python/pyspark/ml/recommendation.py
      @@ -320,7 +320,7 @@ class ALS(JavaEstimator, _ALSParams, JavaMLWritable, JavaMLReadable):
           >>> test = spark.createDataFrame([(0, 2), (1, 0), (2, 0)], ["user", "item"])
           >>> predictions = sorted(model.transform(test).collect(), key=lambda r: r[0])
           >>> predictions[0]
      -    Row(user=0, item=2, newPrediction=0.69291...)
      +    Row(user=0, item=2, newPrediction=0.6929...)
           >>> predictions[1]
           Row(user=1, item=0, newPrediction=3.47356...)
           >>> predictions[2]
      
      

      Attachments

        Activity

          People

            zero323 Maciej Szymkiewicz
            zero323 Maciej Szymkiewicz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: