Exam2pass
0 items Sign In or Register
  • Home
  • IT Exams
  • Guarantee
  • FAQs
  • Reviews
  • Contact Us
  • Demo
Exam2pass > Databricks > Databricks Certifications > DATABRICKS-MACHINE-LEARNING-ASSOCIATE > DATABRICKS-MACHINE-LEARNING-ASSOCIATE Online Practice Questions and Answers

DATABRICKS-MACHINE-LEARNING-ASSOCIATE Online Practice Questions and Answers

Questions 4

A data scientist wants to use Spark ML to one-hot encode the categorical features in their PySpark DataFramefeatures_df. A list of the names of the string columns is assigned to theinput_columnsvariable.

They have developed this code block to accomplish this task:

The code block is returning an error.

Which of the following adjustments does the data scientist need to make to accomplish this task?

A. They need to specify the method parameter to the OneHotEncoder.

B. They need to remove the line with the fit operation.

C. They need to use Stringlndexer prior to one-hot encodinq the features.

D. They need to useVectorAssemblerprior to one-hot encoding the features.

Buy Now

Correct Answer: C

TheOneHotEncoderin Spark ML requires numerical indices as inputs rather than string labels. Therefore, you need to first convert the string columns to numerical indices usingStringIndexer. After that, you can applyOneHotEncoderto these

indices.

Corrected code:

frompyspark.ml.featureimportStringIndexer, OneHotEncoder# Convert string column to indexindexers = [StringIndexer(inputCol=col,

outputCol=col+"_index")forcolininput_columns] indexer_model = Pipeline(stages=indexers).fit(features_df) indexed_features_df = indexer_model.transform(features_df)# One-hot encode the indexed columnsohe = OneHotEncoder

(inputCols=[col+"_index"forcolininput_columns], outputCols=output_columns) ohe_model = ohe.fit(indexed_features_df) ohe_features_df = ohe_model.transform(indexed_features_df)

References:

PySpark ML Documentation

Questions 5

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?

A. They can refactor their notebook to process the data in parallel.

B. They can refactor their notebook to use the PySpark DataFrame API.

C. They can refactor their notebook to use the Scala Dataset API.

D. They can refactor their notebook to use Spark SQL.

E. They can refactor their notebook to utilize the pandas API on Spark.

Buy Now

Correct Answer: E

The data scientist can refactor their notebook to utilize the pandas API on Spark (now known aspandas on Spark, formerlyKoalas). 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 Sparkprovides 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.References:

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

Questions 6

A data scientist has been given an incomplete notebook from the data engineering team. The notebook uses a Spark DataFrame spark_df on which the data scientist needs to perform further feature engineering. Unfortunately, the data scientist has not yet learned the PySpark DataFrame API.

Which of the following blocks of code can the data scientist run to be able to use the pandas API on Spark?

A. import pyspark.pandas as ps df = ps.DataFrame(spark_df)

B. import pyspark.pandas as ps df = ps.to_pandas(spark_df)

C. spark_df.to_sql()

D. import pandas as pd df = pd.DataFrame(spark_df)

E. spark_df.to_pandas()

Buy Now

Correct Answer: A

To use the pandas API on Spark, which is designed to bridge the gap between the simplicity of pandas and the scalability of Spark, the correct approach involves importing the pyspark.pandas (recently renamed topandas_api_on_spark)

module and converting a Spark DataFrame to a pandas-on-Spark DataFrame using this API. The provided syntax correctly initializes a pandas-on-Spark DataFrame, allowing the data scientist to work with the familiar pandas-like API on large

datasets managed by Spark.

References:

Pandas API on Spark

Documentation:https://spark.apache.org/docs/latest/api/python/user_guide/pandas _on_spark/index.html

Questions 7

A data scientist has a Spark DataFrame spark_df. They want to create a new Spark DataFrame that contains only the rows from spark_df where the value in column price is greater than 0.

Which of the following code blocks will accomplish this task?

A. spark_df[spark_df["price"] > 0]

B. spark_df.filter(col("price") > 0)

C. SELECT * FROM spark_df WHERE price > 0

D. spark_df.loc[spark_df["price"] > 0,:]

E. spark_df.loc[:,spark_df["price"] > 0]

Buy Now

Correct Answer: B

To filter rows in a Spark DataFrame based on a condition, you use thefilter method along with a column condition. The correct syntax in PySpark to accomplish this task isspark_df.filter(col("price") > 0), which filters the DataFrame to include

only those rows where the value in the "price" column is greater than 0. Thecolfunction is used to specify column-based operations. The other options provided either do not use correct Spark DataFrame syntax or are intended for different

types of data manipulation frameworks like pandas.References:

PySpark DataFrame API documentation (Filtering DataFrames).

Questions 8

A data scientist wants to tune a set of hyperparameters for a machine learning model. They have wrapped a Spark ML model in the objective functionobjective_functionand they have defined the search spacesearch_space.

As a result, they have the following code block: Which of the following changes do they need to make to the above code block in order to accomplish the task?

A. Change SparkTrials() to Trials()

B. Reduce num_evals to be less than 10

C. Change fmin() to fmax()

D. Remove the trials=trials argument

E. Remove the algo=tpe.suggest argument

Buy Now

Correct Answer: A

TheSparkTrials()is used to distribute trials of hyperparameter tuning across a Spark cluster. If the environment does not support Spark or if the user prefers not to usedistributed computing for this purpose, switching toTrials()would be

appropriate.Trials() is the standard class for managing search trials in Hyperopt but does not distribute the computation. If the user is encountering issues withSparkTrials()possibly due to an unsupported configuration or an error in the cluster

setup, usingTrials()can be a suitable change for running the optimization locally or in a non-distributed manner.

References:

Hyperopt documentation: http://hyperopt.github.io/hyperopt/

Questions 9

A machine learning engineer is converting a decision tree from sklearn to Spark ML. They notice that they are receiving different results despite all of their data and manually specified hyperparameter values being identical.

Which of the following describes a reason that the single-node sklearn decision tree and the Spark ML decision tree can differ?

A. Spark ML decision trees test every feature variable in the splitting algorithm

B. Spark ML decision trees automatically prune overfit trees

C. Spark ML decision trees test more split candidates in the splitting algorithm

D. Spark ML decision trees test a random sample of feature variables in the splitting algorithm

E. Spark ML decision trees test binned features values as representative split candidates

Buy Now

Correct Answer: E

One reason that results can differ between sklearn and Spark ML decision trees, despite identical data and hyperparameters, is that Spark ML decision trees test binned feature values as representative split candidates. Spark ML uses a

method called "quantile binning" to reduce the number of potential split points by grouping continuous features into bins. This binning process can lead to different splits compared to sklearn, which tests all possible split points directly. This

difference in the splitting algorithm can cause variations in the resulting trees.References:

Spark MLlib Documentation (Decision Trees and Quantile Binning).

Questions 10

A data scientist has written a feature engineering notebook that utilizes the pandas library. As the size of the data processed by the notebook increases, the notebook's runtime is drastically increasing, but it is processing slowly as the size of the data included in the process increases.

Which of the following tools can the data scientist use to spend the least amount of time refactoring their notebook to scale with big data?

A. PySpark DataFrame API

B. pandas API on Spark

C. Spark SQL

D. Feature Store

Buy Now

Correct Answer: B

The pandas API on Spark provides a way to scale pandas operations to big data while minimizing the need for refactoring existing pandas code. It allows users to run pandas operations on Spark DataFrames, leveraging Spark's distributed

computing capabilities to handle large datasets more efficiently. This approach requires minimal changes to the existing code, making it a convenient option for scaling pandas-based feature engineering notebooks.

References:

Databricks documentation on pandas API on Spark: pandas API on Spark

Questions 11

Which of the following machine learning algorithms typically uses bagging?

A. Gradient boosted trees B. K-means

C. Random forest

D. Linear regression

E. Decision tree

Buy Now

Correct Answer: C

Random Forest is a machine learning algorithm that typically uses bagging (Bootstrap Aggregating). Bagging involves training multiple models independently on different random subsets of the data and then combining their predictions.

Random Forests consist of many decision trees trained on random subsets of the training data and features, and their predictions are averaged to improve accuracy and control overfitting. This method enhances model robustness and

predictive performance.References:

Ensemble Methods in Machine Learning (Understanding Bagging and Random Forests).

Questions 12

A team is developing guidelines on when to use various evaluation metrics for classification problems. The team needs to provide input on when to use the F1 score over accuracy.

Which of the following suggestions should the team include in their guidelines?

A. The F1 score should be utilized over accuracy when the number of actual positive cases is identical to the number of actual negative cases.

B. The F1 score should be utilized over accuracy when there are greater than two classes in the target variable.

C. The F1 score should be utilized over accuracy when there is significant imbalance between positive and negative classes and avoiding false negatives is a priority.

D. The F1 score should be utilized over accuracy when identifying true positives and true negatives are equally important to the business problem.

Buy Now

Correct Answer: C

The F1 score is the harmonic mean of precision and recall and is particularly useful in situations where there is a significant imbalance between positive and negative classes. When there is a class imbalance, accuracy can be misleading

because a model can achieve high accuracy by simply predicting the majority class. The F1 score, however, provides a better measure of the test's accuracy in terms of both false positives and false negatives.

Specifically, the F1 score should be used over accuracy when:

There is a significant imbalance between positive and negative classes. Avoiding false negatives is a priority, meaning recall (the ability to detect all positive instances) is crucial.

In this scenario, the F1 score balances both precision (the ability to avoid false positives) and recall, providing a more meaningful measure of a model's performance under these conditions.

References:

Databricks documentation on classification metrics: Classification Metrics

Questions 13

A machine learning engineer is trying to scale a machine learning pipeline by distributing its feature engineering process.

Which of the following feature engineering tasks will be the least efficient to distribute?

A. One-hot encoding categorical features

B. Target encoding categorical features

C. Imputing missing feature values with the mean

D. Imputing missing feature values with the true median

E. Creating binary indicator features for missing values

Buy Now

Correct Answer: D

Among the options listed, calculating the true median for imputing missing feature values is the least efficient to distribute. This is because the true median requires knowledge of the entire data distribution, which can be computationally

expensive in a distributed environment. Unlike mean or mode, finding the median requires sorting the data or maintaining a full distribution, which is more intensive and often requires shuffling the data across partitions.

References:

Challenges in parallel processing and distributed computing for data aggregation like median calculation:https://www.apache.org

Exam Code: DATABRICKS-MACHINE-LEARNING-ASSOCIATE
Exam Name: Databricks Certified Machine Learning Associate
Last Update: Jul 07, 2026
Questions: 74

PDF (Q&A)

$45.99
ADD TO CART

VCE

$49.99
ADD TO CART

PDF + VCE

$59.99
ADD TO CART

Exam2Pass----The Most Reliable Exam Preparation Assistance

There are tens of thousands of certification exam dumps provided on the internet. And how to choose the most reliable one among them is the first problem one certification candidate should face. Exam2Pass provide a shot cut to pass the exam and get the certification. If you need help on any questions or any Exam2Pass exam PDF and VCE simulators, customer support team is ready to help at any time when required.

Home | Guarantee & Policy |  Privacy & Policy |  Terms & Conditions |  How to buy |  FAQs |  About Us |  Contact Us |  Demo |  Reviews

2026 Copyright @ exam2pass.com All trademarks are the property of their respective vendors. We are not associated with any of them.