Databricks Machine Learning Associate · Section 2 · 19% of the exam
Identify scenarios where log scale transformation is appropriate
One of the objectives of the Databricks Certified Machine Learning Associate exam, in the section “Data Processing”. Here is what it covers, the points to remember and a question to try.
What it covers
Choose the right chart for categorical and continuous features, compare two continuous features with scatter plots and correlation and two categorical features with contingency tables and the chi-square test, and recognize when a log transform makes a skewed feature or target easier to model.
Points to remember
- One categorical feature: bar chart of counts. One continuous feature: histogram or box plot.
- Categorical versus continuous: box plot per category.
- Two continuous features: scatter plot plus correlation. Pearson measures linear association; Spearman uses ranks and is robust to outliers.
df.stat.corrsupports only Pearson;pyspark.ml.stat.Correlation.corr(df, vecCol, 'spearman')gives a Spearman matrix.- Two categorical features:
df.stat.crosstab(c1, c2)as a heatmap or stacked bar, plusChiSquareTestfor independence.
Try a question
Before choosing a model, a data scientist wants to see whether listing price rises with square footage and whether the relationship looks linear. Both sqft and price are continuous. Which visualization should they create first?
- AA pie chart of total price per square-footage value
- BA scatter plot of
sqftagainstprice - CA bar chart of row counts per
sqftvalue - DA contingency table of
sqftandpriceshown as a heatmap
Show the answer
B. A scatter plot shows the direction, strength and shape (linear or curved) of the relationship between two continuous features, and extreme points stand out. Quantify it afterwards with a correlation coefficient: Pearson for a linear relationship, Spearman for a monotonic one or when outliers are present. Bar and pie charts and contingency tables are for categorical features.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson Visualizing, Comparing and Log-Transforming Features teaches this objective (about 40 minutes), and 16 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.
More in this section
- Compute summary statistics on a Spark DataFrame using .summary() or dbutils data summaries
- Remove outliers from a Spark DataFrame based on standard deviation or IQR
- Create visualizations for categorical or continuous features
- Compare two categorical or two continuous features using the appropriate method
- Compare and contrast imputing missing values with the mean or median or mode value
- Impute missing values with the mode, mean, or median value
- Use one-hot encoding for categorical features
- Identify and explain the model types or data sets for which one-hot encoding is or is not appropriate.