I have a data file with three columns, and I want to normalize the last column to apply ALS with ML (Spark and Scala), how can I do it?
Here is an excerpt from my Dataframe
:
val view_df = spark.createDataFrame(view_RDD, viewSchema)
val viewdd = view_df.withColumn("userIdTemp", view_df("userId").cast(IntegerType)).drop("userId")
.withColumnRenamed("userIdTemp", "userId")
.withColumn("productIdTemp", view_df("productId").cast(IntegerType)).drop("productId")
.withColumnRenamed("productIdTemp", "productId")
.withColumn("viewTemp", view_df("view").cast(FloatType)).drop("view")
.withColumnRenamed("viewTemp", "view")`