code: def test_all_tiny(self):
      customer_index = StringIndexer(
          inputCol=USER_ID, outputCol=USER_ID_INDEX
      )
      ratings_index = StringIndexer(
          inputCol=ITEM_ID, outputCol=ITEM_ID_INDEX
      )
  
      pipeline = Pipeline(stages=[customer_index, ratings_index])
      transformed_df = pipeline.fit(ratings).transform(ratings)
  
      als = ALS(
          userCol=customer_index.getOutputCol(),
          ratingCol=RATING_ID,
          itemCol=ratings_index.getOutputCol(),
      )
      als_model = als.fit(transformed_df)
      users_recs = als_model.recommendForAllUsers(3)
      print(
          "One Sample User Recommendation: " + str(users_recs.take(1))
      )
  
      param_grid = (
          ParamGridBuilder().addGrid(als.regParam, [1.0]).build()
      )
  
      evaluator = RankingEvaluator()
  
      tv_recommendation_split = (
          RankingTrainValidationSplit(
              estimator=als, evaluator=evaluator
          )
          .setEstimatorParamMaps(param_grid)
          .setUserCol(customer_index.getOutputCol())
          .setItemCol(ratings_index.getOutputCol())
          .setRatingCol("rating")
          .setRatingCol("rating")
          .setTrainRatio(0.8)
      )
  
      tv_model = tv_recommendation_split.fit(transformed_df)
      users_recs = tv_model.recommendForAllUsers(3)
  
      print("Sample User Recommendation: " + str(users_recs.take(1)))
      print("Validation Metrics: " + str(tv_model.validationMetrics))
  
file_path: SynapseML/core/src/test/python/synapsemltest/recommendation/test_ranking.py
imports: import unittest
  from synapse.ml.recommendation import RankingAdapter
  from synapse.ml.recommendation import RankingEvaluator
  from synapse.ml.recommendation import RankingTrainValidationSplit
  from synapse.ml.recommendation import RecommendationIndexer
  from synapse.ml.recommendation import SAR
  from synapsemltest.spark import *
  from pyspark.ml import Pipeline
  from pyspark.ml.feature import StringIndexer
  from pyspark.ml.recommendation import ALS
  from pyspark.ml.tuning import ParamGridBuilder
label_desc: Use image node_id 2 for calling the RankingSpec obj's underlying member method code with example usage: obj.test_all_tiny() without return types