0% found this document useful (0 votes)
2 views28 pages

7. Data Visualization

The document discusses data visualization techniques, including univariate, bivariate, and multivariate analysis, and highlights various visualization methods such as box plots, scatter plots, and heatmaps. It also covers dimensionality reduction techniques like feature selection and extraction to manage high-dimensional data effectively. The content is aimed at enhancing understanding of data representation and analysis for informed decision-making.

Uploaded by

lavanyabandi2411
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views28 pages

7. Data Visualization

The document discusses data visualization techniques, including univariate, bivariate, and multivariate analysis, and highlights various visualization methods such as box plots, scatter plots, and heatmaps. It also covers dimensionality reduction techniques like feature selection and extraction to manage high-dimensional data effectively. The content is aimed at enhancing understanding of data representation and analysis for informed decision-making.

Uploaded by

lavanyabandi2411
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Data Visualization

Plotting Techniques

iHub-Data-FMML 2023
Data Visualization

Team Round 1 Round 2 Round 3


A 38 15 18
B 58 57 28
C 14 79 49
D 95 43 28
E 68 92 83

iHub-Data-FMML 2023
Data Visualization

X2

Noise

iHub-Data-FMML 2023
Data Visualization
 Data visualization deals with a visual representation of data and is part of data analysis.

 It is the process of translating data into a chart, graph, or other visual components.

 Data visualization can be used for:

 Making data engaging and easily digestible

 Identifying trends and outliers within a set of data

 Highlighting the important parts of a set of data

iHub-Data-FMML 2023
Variables
 Variables refer to characteristics, properties, or attributes that can be measured,
observed, or recorded for a particular entity or unit within a dataset
 Types of Variables: Dependent Variables, Independent Variables

 Based on the nature:

Qualitative (Categorical): It describes the quality of something or someone. It is descriptive


information. For e.g., skin color, eye color gives us qualitative information about a person.

Quantitative (Numerical): It provides numerical information, like how much, how many, or
how often. Can be continuous or discrete. For e.g., the height and weight of a person.

iHub-Data-FMML 2023
Univariate Analysis
 Univariate Analysis is used in statistics to describe a data type that contains only one
attribute or characteristic

Data = [0.49,-1.13,2.64,0.15,-1.23,-0.24,1.58,0.77,-0.47, 0.54, -2.46, -0.44, 0.22, 0.76,1.24,


-0.54,-2.11,0.12,0.02,-1.15,....., 0.32,-0.12,0.19]

 Includes checking the central tendency (mean, median and mode), the range, the
maximum and minimum values and the standard deviation of a variable

iHub-Data-FMML 2023
Univariate Analysis
Data = [0.49,-1.13,2.64,0.15,-1.23,-0.24,1.58,0.77,-0.47, 0.54, -2.46, -0.44, 0.22, 0.76,1.24,
-0.54,-2.11,0.12,0.02,-1.15,....., 0.32,-0.12,0.19]

Box Plot: Compare the spread of the


Histogram: Frequency distribution
variables and get an insight into outlier
graph
iHub-Data-FMML 2023
Bivariate Analysis
 The bivariate analysis is mainly used to compare two
sets of data to find a relationship between the two
variables.

 Remember, that if one variable influences the


change in another variable, then you have an
independent and dependent variable.

 Ex:- Scatter Plot, Heatmap, Contour Plot, Bivariate


Line Chart, Pair Plot, etc. Scatter Plot: Captures the correlation
between the two

iHub-Data-FMML 2023
Multivariate Analysis

 Multivariate analysis is used to reveal the


relationship among several variables simultaneously.

 Assists in making informed decisions by considering


multiple variables and their interactions
simultaneously.

 Ex: - Grouped Box Plot, Multivariate Scatter Plot, and


3D scatter plot.

iHub-Data-FMML 2023
Visualization Techniques

 Distribution of data points: Box plot, Histogram

 Comparison of data points: Multi-line chart, Bar plot, Line chart [to show trends in data]

 Relationship/Correlation of data points: Scatter plot

 Composition of data points: Pie chart, Stacked Area chart, Stacked Bar chart

iHub-Data-FMML 2023
Violin Plot

Data = [0.49,-1.13,2.64,0.15,-1.23,-0.24,1.58,0.77,-0.47, 0.54, -2.46, -0.44, 0.22, 0.76,1.24, -


0.54,-2.11,0.12,0.02,-1.15,....., 0.32,-0.12,0.19]

 The box plot is convenient for comparing summary


statistics (such as range and quartiles), but it doesn't
let you see variations in the data.
 Are most of the values clustered around the
median, or around the minimum/maximum?
 The histogram and kernel density estimation
helps you in seeing the variations in the data,
but you miss the outliers
iHub-Data-FMML 2023
Can we combine both?
Violin Plot Higher Probability

Median
 It is a combination of box plot and a 1.5 * IQR
kernel density plot, which shows
peaks in the data

 It depicts the summary statistics and IQR


the density of each variable Lower Probability

iHub-Data-FMML 2023
Violin Plot

Vertical violins, grouped by two variables Split violins to take up less space

Plot Courtesy: Seaborn Documentation [[Link]]


iHub-Data-FMML 2023
Pair Plot
 Pair plot visualizes given data to find the
relationship between them and plots
pairwise relationships in a data-set

 It is used for exploring the relationship


between multiple variables at once

 Plots in a matrix format


o Diagonal subplots are the univariate histograms
for each attribute
o Off-diagonal entries are the scatter plots

Plot Courtesy: Seaborn Documentation [[Link]]


iHub-Data-FMML 2023
Joint Plot
 Joint plot combines univariate and bivariate
plots to visualize relationship between two
variables

 It consists of a scatter plot for the bivariate


relationship, with additional marginal plots
for each variable

 Helps in understanding the correlations and


distributions of two variables simultaneously

Plot Courtesy: Seaborn Documentation [[Link]]


iHub-Data-FMML 2023
Heatmap
 A heatmap is a color-coded representation
of a 2-dimensional data, representing the
magnitude of individual values within a
dataset

 Colours are used to represent the


magnitude, intensity, with the colour
gradient scheme ranging from a lighter
colour (low values) to a darker colour (high
values)

 Displays the correlations or relationships in Plot Courtesy: Seaborn Documentation [[Link]]


a correlation matrix
iHub-Data-FMML 2023
Parallel Co-ordinates
 Parallel Co-ordinates allows forthe comparison
of multiple data records, by using parallel lines to
connect points based on multiple numerical
variables

o Each vertical line is a dimension


o A data item is connected by line segments
o Large number of samples clutters the
visualization

iHub-Data-FMML 2023
Dimensionality Reduction

iHub-Data-FMML 2023
Dimensionality
 The number of input variables or features for a dataset is referred to
as its dimensionality.

 The difficulties related to training machine learning models due to


high dimensional data is referred to as ‘Curse of Dimensionality’.

 When dealing with high dimensional data, it is often useful to reduce the
dimensionality by projecting the data to a lower dimensional subspace
which captures the “essence” of the data. This is called dimensionality
reduction.
— Page 11, Machine Learning: A Probabilistic Perspective, 2012.
iHub-Data-FMML 2023
Dimensionality Reduction
 Feature Selection
o Select the most relevant subset of features

o Reducing the number of irrelevant or redundant features

 Feature Extraction
o extracting/deriving information from the
original features set to create a new features
𝟏
subspace
𝟏 𝟐
o compress the data with the goal of 𝟐 𝟑
maintaining most of the relevant information 𝟒
iHub-Data-FMML 2023
Feature Selection Techniques
 Forward Feature Selection
Wrapper Method  Backward Feature Elimination
Supervised  Bi-directional Elimination
Techniques
 Information Gain
Filter Method  Chi-square Test
Feature Selection  Fischer’s Score
Techniques
Embedded Method  Regularization
 Random Forest

Unsupervised Correlation based


Techniques Feature Selection
iHub-Data-FMML 2023
Forward-Feature Selection
 Iteratively selects one feature at a time, evaluating the model's performance after adding
each feature and keeping the best subset of features that maximizes or minimizes the
chosen performance metric.
 Step 1: Initialization: Initialize an empty set S to store the selected features
 Step 2: Loop over Features: For each feature Xi to be added to S
 Find Xi that best improves the model's performance metric when added to S
 Update the selected Xi to S
 Step 3: Termination:
 Repeat Step 2 until adding any remaining feature does not improve the model's
performance.
 Return S as the selected feature subset

iHub-Data-FMML 2023
Forward Feature Selection
Sr. no Feature_idx Avg_Score
1 (10,) 0.541
2 (5,10) 0.638
3 (5,8,10) 0.682
4 (5,7,8,10) 0.696
5 (4,5,7,8,10) 0.715
6 (3,4,5,7,8,10) 0.721
7 (3,4,5,7,8,9,10) 0.724
8 (1,3,4,5,7,8,9,10) 0.728
9 (0,1,3,4,5,7,8,9,10) 0.729
10 (0,1,2,3,4,5,7,8,9,10) 0.730
11 (0,1,2,3,4,5,6,7,8,9,10) 0.732
iHub-Data-FMML 2023
Backward Feature Elimination
BackwardFeatureElimination(X, y):
S = {all features} # Initialize with all features
 Start with all available features, iteratively best_score = EvaluateModel(X, y, S) # Evaluate initial model
remove one feature at a time, and using all features
evaluate the model's performance. while there are remaining features in S:
for feature in S:
 If the performance improves, we keep the Remove feature from S
Train a model using the features in S
feature removed; otherwise, we add it Evaluate model performance using a chosen metric
back. If model performance improves compared to
best_score:
Update best_score to the new performance
 The final set of features that maximizes or else:
minimizes the chosen performance metric Add feature back to S
is returned as the selected feature subset.
return S # Return the remaining features after elimination

iHub-Data-FMML 2023
Backward Elimination
Sr. no Feature_idx Avg_Score
11 (0,1,2,3,4,5,6,7,8,9,10) 0.732
10 (0,1,2,3,4,5,7,8,9,10) 0.730
9 (0,1,3,4,5,7,8,9,10) 0.729
8 (1,3,4,5,7,8,9,10) 0.728
7 (3,4,5,7,8,9,10) 0.724
6 (3,4,5,7,8,10) 0.721
5 (4,5,7,8,10) 0.715
4 (5,7,8,10) 0.696
3 (5,8,10) 0.682
2 (5,10) 0.638
1 (10,) 0.541
iHub-Data-FMML 2023
Bi-directional Elimination
 Combines forward and backward feature selection techniques to iteratively select a subset
of features that optimizes a model performance metric
 Step 1: Initialization: Initialize an empty set S to store the selected features and choose
direction
 Step 2: Loop over Features: For direction chosen as ‘forward’ or ‘backward’
 If ‘forward’: Perform forward selection adding the best feature that
improves the model's performance metric
 If ‘backward’: Perform backward elimination, removing the least significant
feature
 Step 3: Termination:
 Repeat Step 2 until adding/eliminating any remaining feature does not improve the
model's performance.
 Return S as the selected feature subset
iHub-Data-FMML 2023
Feature Extraction
 Aims to reduce the number of features in a dataset by creating new features from the
existing ones (discarding the original ones)
 Feature Extraction Techniques:
o Principal Component Analysis: Linear transformation techniques by finding
orthogonal axes that capture the most variance

Image Source: [Link]

iHub-Data-FMML 2023
Feature Extraction
 Aims to reduce the number of features in a dataset by creating new features from the
existing ones (discarding the original ones)
 Feature Extraction Techniques:
o Isomap, t-SNE(t-distributed Stochastic Neighbor Embedding): Non-linear
dimensionality reduction technique that emphasizes the local structure of the data

Image Source : [Link]

iHub-Data-FMML 2023

You might also like