CertNote/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
Linux Master 2 · 2급KAIT Linux Master - Level 2
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
MLA-C01 · AssociateMachine Learning Engineer - Associate
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
  • Week 1
    • 1.The ML Lifecycle (from a Specialty Perspective)
    • 2.Data Storage for ML: S3, EFS, FSx for Lustre, and Data Formats
    • 3.Data Ingestion: Kinesis, Glue, Batch vs. Streaming
    • 4.Data Labeling: SageMaker Ground Truth, Active Learning, Label Quality
    • 5.Week 1 Comprehensive Review: ML Overview & Data Engineering 1
  • Week 2
  • Week 3
  • Week 4
    • 1.Dimensionality Reduction: PCA, t-SNE, and the Curse of Dimensionality
    • 2.Feature Selection: Filter, Wrapper and Embedded Methods, Importance, and Multicollinearity
    • 3.Data Visualization: Distributions, Correlations, QuickSight, and Drawing Insights
    • 4.Handling Class Imbalance: Oversampling, Undersampling, SMOTE, Class Weights, Evaluation
    • 5.Week 4 Comprehensive Review: Dimensionality, Feature Selection, Visualization, Imbalance
  • Week 5
  • Week 6
  • Week 7
  • Week 8
  • Week 9
  • Week 10
  • Week 11
  • Week 12
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← MLS-C01/Week 4/Day 3

Based on the MLS-C01 exam guide·Report an error

MLS-C01· AssociateWeek 4 · Day 3~31 min read

Day 3 - Data Visualization: Distributions, Correlations, QuickSight, and Drawing Insights

📌 Key Takeaways

  • The question decides the chart. For distributions use histograms, box plots and violin plots; for relationships use scatter plots, correlation heatmaps and pair plots.
  • Anscombe's quartet: the same statistical summary can hide completely different shapes → never trust summary values alone; always plot.
  • Pearson captures only linear relationships. Check monotonic nonlinear relationships with Spearman and general dependence with mutual information.
  • QuickSight is a serverless BI service. Remember SPICE (in-memory engine), ML Insights (anomaly detection, forecasting, automatic narratives) and Q (natural-language queries).
  • The goal of visualization is not the picture but the follow-up action: skew → log transform, strong correlation → handle multicollinearity.

Chart Selection: The Question Decides the Chart

Once cleaning and dimensionality work are done, the next job is understanding the data by eye. Good visualization reveals the distribution shape, outliers, relationships and clusters that summary statistics hide. MLS-C01 Domain 2 asks both "which chart for which question" and "which AWS service for visualization and BI."

Analysis goalSuitable chart
Distribution of a single numeric variableHistogram, KDE, box plot, violin
Frequency by categoryBar chart
Relationship between two numeric variablesScatter plot, hexbin
Correlation among several variablesCorrelation heatmap, pair plot
Trend over timeLine chart
Composition relative to the wholeStacked bar

Before choosing a chart, first ask "what question am I trying to answer right now?" The wrong chart hides or distorts patterns.

Misunderstandings Created by the Wrong Chart

SituationWrong choiceWhat goes wrongRight choice
You want to see the distribution of a numeric variablePie chartThe distribution shape, tails and outliers all vanishHistogram + box plot
Composition across 20 categoriesPie chartSlices are cut too fine to compareSorted bar chart
Relationship between two variablesTwo line chartsOnly each variable's trend shows; the relationship does notScatter plot
A scatter plot with hundreds of thousands of pointsScatter plot as isOverplotting smears the points and density is invisibleHexbin or sampling
Comparing distributions across categoriesPer-category mean barsMeans can be equal while distributions differViolin / box plot

⚠️ Pitfall: The same data can give the opposite impression depending on how the axes are set. If a bar chart's y-axis starts at a non-zero value, a trivial difference looks dramatic, and overlaying different units on a dual axis makes a nonexistent correlation appear. Whether reading or making a chart, check the axis range first.

Anscombe's quartet shows datasets whose summary statistics (mean, variance, correlation) are identical but whose shapes are entirely different. The four datasets have nearly the same means, variances, correlations and regression lines, but as scatter plots one is linear, one is curved, and in one a single outlier drags the whole fit. The lesson is "don't trust summary statistics alone; always visualize," and this is why visualization is indispensable in EDA.

Distribution Visualization

import seaborn as sns
import matplotlib.pyplot as plt
 
fig, axes = plt.subplots(1, 3, figsize=(15, 4))
sns.histplot(df["income"], kde=True, ax=axes[0])   # shape + density
sns.boxplot(x=df["income"], ax=axes[1])             # quartiles, outliers
sns.violinplot(x=df["region"], y=df["income"], ax=axes[2])  # distribution by category
  • Histogram/KDE: see the distribution shape (skew, number of peaks)
  • Box plot: quickly catches the median, quartiles and IQR-based outliers
  • Violin: box plot + density. Strong for comparing distributions across categories

For a skewed distribution, apply a log transform and plot again to check whether it moves closer to normal.

 Normal (symmetric)  Right-skewed (right tail)  Bimodal            Outliers present
   ▁▃▅█▅▃▁           ▂█▆▄▃▂▁▁▁▁            ▃█▄▁▁▄█▃          ▂▅█▅▂       ·  ·
 mean ≈ median       mean > median          two peaks          extreme values in the tail
 → use as is         → log(1+x) transform   → hidden segments  → check IQR · domain

Distribution Diagnosis → Preprocessing Prescription

What you see in the chartDiagnosisFollow-up preprocessing
Long right tailRight skewLog transform such as log(1+x), or use a tree-family model
Two or more peaksMixed subgroupsAdd a segment variable, or split into per-group models
Extreme values outside the box plotOutlier candidatesCheck whether it is a measurement error or a real signal, then remove, winsorize or use a robust model
Values are nearly all one kindConstant / quasi-constant columnRemove the column (no information)
Scales differ by tens of times across variablesScale imbalanceStandardization (mandatory before PCA, KNN, neural networks)
Class bars are 99:1Class imbalanceDay 4's resampling, class weights, PR-AUC

⚠️ Pitfall: Changing a histogram's number of bins can make the same data look entirely different. With too few bins, peaks are smeared; with too many, noise looks like peaks. If the shape is ambiguous, vary the bin count or plot a KDE alongside.

Relationship and Correlation Visualization

# Correlation heatmap: linear relationships at a glance
corr = df.select_dtypes("number").corr()
sns.heatmap(corr, annot=True, cmap="coolwarm", center=0)
 
# Pair plot: pairwise relationships + diagonal distributions
sns.pairplot(df, hue="target", vars=["age", "income", "score"])
  • A correlation heatmap simultaneously reveals multicollinearity candidates (pairs with large |r|) and relationships with the target
  • A pair plot reveals nonlinear relationships, clusters and outliers between variable pairs

Comparison of Correlation and Dependence Metrics

MetricRelationship capturedWhen to useLimitation
Pearson correlationLinearDefault check, searching for multicollinearity candidatesComes out near 0 for curved relationships
Spearman rank correlationMonotonicNonlinear but with a consistent directionCannot catch non-monotonic (U-shaped) relationships
Mutual informationGeneral dependenceWhen you do not know the form of the relationshipHard to interpret in absolute terms, and costly to compute
Scatter plot (by eye)Every formAlways alongsideHard to inspect one by one when there are many variable pairs

Pearson correlation captures only linear relationships. Even a perfect curved relationship (e.g., y = x²) can give a Pearson r near 0. Spearman rank correlation better catches relationships that are monotonic but nonlinear, and mutual information better catches general dependence. So do not conclude "low correlation = no relationship"; confirm the shape with a scatter plot.

A large |r| in a correlation heatmap does not immediately imply causation. Two variables moving together can be due to a common third cause or a time trend. Visualization is a tool for generating hypotheses, not for proving causation.

Three Distribution Charts: When to Use Which

ChartWhat it shows bestWhat it missesWhen to use
Histogram/KDEShape (skew, number of peaks)Exact quartiles and outlier boundariesWhen first looking at a variable
Box plotMedian, quartiles, extreme values beyond the IQRWhether there are two peaksWhen judging outliers
ViolinDifferences in distribution shape by categoryThe exact positions of individual extreme valuesWhen checking whether a category is a good feature

Amazon QuickSight

QuickSight is AWS's serverless BI service for building and sharing dashboards and visualizations.

FeatureDescription
SPICEIn-memory compute engine for fast aggregation and visualization
Data sourcesConnects directly to S3, Athena, Redshift, RDS, Aurora, etc.
ML InsightsAnomaly detection, forecasting, automatic narratives
QGenerates visualizations from natural-language queries ("sales by region last month")
ServerlessNo infrastructure management, pay for what you use

QuickSight suits operational dashboards and business reporting. For pre-training EDA exploration, a notebook (matplotlib/seaborn) or SageMaker Data Wrangler is closer to the workflow.

QuickSight's ML Insights automatically detects anomalies in time series with built-in ML, provides forecasts based on Random Cut Forest, and explains changes in natural language. Analysts get ML insights inside the BI dashboard without writing a model themselves. On the exam, a question saying "business users who do not write code want an anomaly detection and forecasting dashboard" points to QuickSight ML Insights.

Comparison of AWS Visualization and Analysis Tools

ToolLocationMain use
matplotlib/seabornSageMaker notebookCode-based EDA, free customization
SageMaker Data WranglerSageMaker StudioVisual data preparation + distribution/correlation reports
Amazon QuickSightStandalone BI serviceDashboards, business reporting, ML Insights
Athena + QuickSightDirect queries on S3Serverless SQL analysis → visualization

Situation → Tool Choice

SituationTool to pickReason
A data scientist freely explores distributions and correlations before trainingSageMaker notebook + seabornYou can plot anything with code
You want distribution and correlation reports while preprocessing without codeSageMaker Data WranglerReports are built into the visual preparation flow
A sales dashboard that business users view every dayAmazon QuickSightServerless BI, centered on sharing and subscriptions
Anomaly detection and forecasting on a dashboard without codeQuickSight ML InsightsBuilt-in ML for anomaly detection, forecasting and automatic narratives
You want to ask in natural language and get a chartQuickSight QGenerates visualizations from natural-language queries
Scan large data in S3 with SQL and visualize itAthena + QuickSightServerless query → serverless BI
The dashboard is slow and you want faster aggregationLoad into SPICEIn-memory compute engine

Drawing Analytical Insights

The goal of visualization is not the picture but an actionable insight.

ObservationInsightNext action
Skewed distributionMay violate linear-model assumptionsConsider a log transform or a robust model
Strongly correlated pairs in the heatmapMulticollinearity candidatesCheck VIF, then remove, use PCA or Ridge
Outliers in the box plotMeasurement error or a real signalIdentify the cause, then decide the handling policy
Large distribution differences by categoryThat category may be a good featureAdopt it as a feature, consider interaction terms
Sudden change points in a time seriesCollection problem or a real eventCheck the data pipeline and the domain
Class bars extremely skewedClass imbalanceConnect to Day 4's countermeasures

EDA Visualization Order

Deciding in advance what to plot first reduces what you miss.

[Secure the training set — visualization is done on the training set only]
        │
  ① One variable at a time: histogram / box plot
        └→ Find skew · outliers · constant columns
        │
  ② Target distribution: class bars or histogram
        └→ Check for imbalance (connects to Day 4)
        │
  ③ Variable ↔ target: per-category violin / scatter plot
        └→ Find good feature candidates
        │
  ④ Variable ↔ variable: correlation heatmap / pair plot
        └→ Find multicollinearity candidates (connects to Day 2)
        │
  ⑤ If there is a time axis: line chart
        └→ Check trends · seasonality · change points
        │
  ⑥ Turn the findings into preprocessing decisions (transform · remove · add features)

Visualization is also an act of looking into the data. If you decide preprocessing by looking at plots that include the test set, it becomes human-mediated leakage. The principle is to do distribution checks, outlier judgments and correlation checks on the training set only, and never open the test set until the final evaluation.

Question Clue → Answer Mapping

Clue in the questionAnswer to chooseReason
"Business users who can't write code, anomaly detection and forecasting dashboard"QuickSight ML InsightsML inside the dashboard without code
"Want to ask in natural language and get a chart"QuickSight QNatural-language query feature
"Query S3 data with SQL and visualize serverlessly"Athena + QuickSightThe standard serverless analytics combination
"Correlation coefficient is 0 but the scatter plot is U-shaped"Pearson measures only linearUse a separate metric for nonlinear relationships
"A case showing you should not trust summary statistics alone"Anscombe's quartetSame summary values, different shapes
"The shape and outliers of a single numeric variable together"Histogram (KDE) + box plotShape + quartiles and outliers
"Distribution and correlation reports before training, without code"SageMaker Data WranglerA visual data-preparation tool
"Dashboard aggregation is slow"SPICEIn-memory compute engine

The next post looks at how to actually deal with the class imbalance that visualization reveals.

📖 Glossary

  • EDA (Exploratory Data Analysis): The process of scanning the data's shape, relationships and anomalies with the eye and with statistics before building a model.
  • KDE (Kernel Density Estimation): A method that turns a histogram's steps into a smooth curve to show the distribution shape.
  • Box plot / IQR: A chart that draws the median and quartiles as a box / the range between the first and third quartiles. Used as the criterion for judging outliers.
  • Violin plot: A chart that overlays a density curve on a box plot. Good for comparing distributions across categories.
  • Hexbin: A scatter-plot variant that expresses density with hexagonal cells instead when there are so many points that they smear together.
  • Anscombe's quartet: Four datasets with nearly identical mean, variance and correlation but completely different scatter-plot shapes. A classic example of why visualization is needed.
  • Spearman rank correlation: A correlation computed on ranks rather than the values themselves. Catches relationships that are monotonic but curved.
  • SPICE: QuickSight's in-memory compute engine. Data is loaded in advance to make aggregation and visualization fast.
  • ML Insights: QuickSight's automatic anomaly detection, forecasting and natural-language explanation feature inside dashboards.
  • QuickSight Q: A feature that builds visualizations when you ask in natural language, such as "sales by region last month."

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

A business user who does not write code wants to see automatic anomaly detection and forecasting on a sales data dashboard. Which AWS service is the MOST appropriate?

Question 2

The Pearson correlation coefficient of two variables is close to 0, but the scatter plot clearly shows a U-shaped curve. What is the correct interpretation?

Question 3

You want to intuitively see both the distribution shape (skew, number of peaks) and the outliers of a single numeric variable. Which combination is MOST appropriate?

Question 4

Which example BEST illustrates the lesson "do not rely only on summary statistics; always visualize"?

Question 5

You want to query large data stored in S3 with SQL and then build a serverless visualization dashboard. Which combination is MOST appropriate?

PreviousFeature Selection: Filter, Wrapper and Embedded Methods, Importance, and MulticollinearityWeek 4 · Day 2Next Handling Class Imbalance: Oversampling, Undersampling, SMOTE, Class Weights, EvaluationWeek 4 · Day 4

Official references

  • MLS-C01 official exam page(opens in a new tab)
  • Amazon QuickSight documentation(opens in a new tab)
  • Amazon SageMaker AI documentation(opens in a new tab)
  • Amazon S3 documentation(opens in a new tab)
  • Amazon Athena documentation(opens in a new tab)

On this page

  • Key Takeaways
  • Chart Selection: The Question Decides the Chart
  • Misunderstandings Created by the Wrong Chart
  • Distribution Visualization
  • Distribution Diagnosis → Preprocessing Prescription
  • Relationship and Correlation Visualization
  • Comparison of Correlation and Dependence Metrics
  • Three Distribution Charts: When to Use Which
  • Amazon QuickSight
  • Comparison of AWS Visualization and Analysis Tools
  • Situation → Tool Choice
  • Drawing Analytical Insights
  • EDA Visualization Order
  • Question Clue → Answer Mapping
  • Glossary
  • Practice Questions