Free Certified Machine Learning Associate Exam Braindumps
Certified Machine Learning Associate Questions 16–20 (page: 5)

Updated On: 10-Feb-2026

Which of the following describes the relationship between native Spark DataFrames and pandas API on Spark DataFrames?

  1. pandas API on Spark DataFrames are single-node versions of Spark DataFrames with additional metadata
  2. pandas API on Spark DataFrames are more performant than Spark DataFrames
  3. pandas API on Spark DataFrames are made up of Spark DataFrames and additional metadata
  4. pandas API on Spark DataFrames are less mutable versions of Spark DataFrames
  5. pandas API on Spark DataFrames are unrelated to Spark DataFrames

Answer(s): C

Explanation:

Pandas API on Spark (previously known as Koalas) provides a pandas-like API on top of Apache Spark. It allows users to perform pandas operations on large datasets using Spark's distributed compute capabilities. Internally, it uses Spark DataFrames and adds metadata that facilitates handling operations in a pandas-like manner, ensuring compatibility and leveraging Spark's performance and scalability.
Reference pandas API on Spark documentation:
https://spark.apache.org/docs/latest/api/python/user_guide/pandas_on_spark/index.html



A data scientist has written a data cleaning notebook that utilizes the pandas library, but their colleague has suggested that they refactor their notebook to scale with big data.
Which of the following approaches can the data scientist take to spend the least amount of time refactoring their notebook to scale with big data?

  1. They can refactor their notebook to process the data in parallel.
  2. They can refactor their notebook to use the PySpark DataFrame API.
  3. They can refactor their notebook to use the Scala Dataset API.
  4. They can refactor their notebook to use Spark SQL.
  5. They can refactor their notebook to utilize the pandas API on Spark.

Answer(s): E

Explanation:

The data scientist can refactor their notebook to utilize the pandas API on Spark (now known as pandas on Spark, formerly Koalas). This allows for the least amount of changes to the existing pandas-based code while scaling to handle big data using Spark's distributed computing capabilities. pandas on Spark provides a similar API to pandas, making the transition smoother and faster compared to completely rewriting the code to use PySpark DataFrame API, Scala Dataset API, or Spark SQL.


Reference:

Databricks documentation on pandas API on Spark (formerly Koalas).



A data scientist has defined a Pandas UDF function predict to parallelize the inference process for a single-node model:



They have written the following incomplete code block to use predict to score each record of Spark DataFrame spark_df:



Which of the following lines of code can be used to complete the code block to successfully complete the task?

  1. predict(*spark_df.columns)
  2. mapInPandas(predict)
  3. predict(Iterator(spark_df))
  4. mapInPandas(predict(spark_df.columns))
  5. predict(spark_df.columns)

Answer(s): B

Explanation:

To apply the Pandas UDF predict to each record of a Spark DataFrame, you use the mapInPandas method. This method allows the Pandas UDF to operate on partitions of the DataFrame as pandas DataFrames, applying the specified function (predict in this case) to each partition. The correct code completion to execute this is simply mapInPandas(predict), which specifies the UDF to use without additional arguments or incorrect function calls.


Reference:

PySpark DataFrame documentation (Using mapInPandas with UDFs).



Which of the Spark operations can be used to randomly split a Spark DataFrame into a training DataFrame and a test DataFrame for downstream use?

  1. TrainValidationSplit
  2. DataFrame.where
  3. CrossValidator
  4. TrainValidationSplitModel
  5. DataFrame.randomSplit

Answer(s): E

Explanation:

The correct method to randomly split a Spark DataFrame into training and test sets is by using the randomSplit method. This method allows you to specify the proportions for the split as a list of weights and returns multiple DataFrames according to those weights. This is directly intended for splitting DataFrames randomly and is the appropriate choice for preparing data for training and testing in machine learning workflows.


Reference:

Apache Spark DataFrame API documentation (DataFrame Operations: randomSplit).



A data scientist is using Spark ML to engineer features for an exploratory machine learning project.

They decide they want to standardize their features using the following code block:



Upon code review, a colleague expressed concern with the features being standardized prior to splitting the data into a training set and a test set.

Which of the following changes can the data scientist make to address the concern?

  1. Utilize the MinMaxScaler object to standardize the training data according to global minimum and maximum values
  2. Utilize the MinMaxScaler object to standardize the test data according to global minimum and maximum values
  3. Utilize a cross-validation process rather than a train-test split process to remove the need for standardizing data
  4. Utilize the Pipeline API to standardize the training data according to the test data's summary statistics
  5. Utilize the Pipeline API to standardize the test data according to the training data's summary statistics

Answer(s): E

Explanation:

To address the concern about standardizing features prior to splitting the data, the correct approach is to use the Pipeline API to ensure that only the training data's summary statistics are used to standardize the test data. This is achieved by fitting the StandardScaler (or any scaler) on the training data and then transforming both the training and test data using the fitted scaler. This approach prevents information leakage from the test data into the model training process and ensures that the model is evaluated fairly.


Reference:

Best Practices in Preprocessing in Spark ML (Handling Data Splits and Feature Standardization).



Viewing page 5 of 16
Viewing questions 21 - 25 out of 140 questions


Post your Comments and Discuss Databricks Certified Machine Learning Associate exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!