Skip to content

Commit a9310a2

Browse files
Merge pull request #283 from DiogoRibeiro7/codex/add-exploratory-data-analysis-post
Add Exploratory Data Analysis post
2 parents 664f12a + 56c72e2 commit a9310a2

20 files changed

+905
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
author_profile: false
3+
categories:
4+
- Statistics
5+
classes: wide
6+
date: '2020-11-05'
7+
excerpt: An introduction to probability theory concepts every data scientist should know.
8+
header:
9+
image: /assets/images/data_science_10.jpg
10+
og_image: /assets/images/data_science_10.jpg
11+
overlay_image: /assets/images/data_science_10.jpg
12+
show_overlay_excerpt: false
13+
teaser: /assets/images/data_science_10.jpg
14+
twitter_image: /assets/images/data_science_10.jpg
15+
keywords:
16+
- Probability theory
17+
- Random variables
18+
- Distributions
19+
- Data science
20+
seo_description: Learn the core principles of probability theory, from random variables to common distributions, with practical examples for data science.
21+
seo_title: 'Probability Theory Basics for Data Science'
22+
seo_type: article
23+
summary: This post reviews essential probability concepts like random variables, expectation, and common distributions, illustrating how they underpin data science workflows.
24+
tags:
25+
- Probability
26+
- Statistics
27+
- Data science
28+
title: 'Probability Theory Basics for Data Science'
29+
---
30+
31+
Probability theory provides the mathematical foundation for modeling uncertainty. By understanding random variables and probability distributions, data scientists can quantify risks and make informed decisions.
32+
33+
## Random Variables and Distributions
34+
35+
A random variable assigns numerical values to outcomes in a sample space. Key distributions such as the binomial, normal, and Poisson describe how probabilities are spread across possible outcomes. Knowing these distributions helps in selecting appropriate models and estimating parameters.
36+
37+
## Expectation and Variance
38+
39+
Two fundamental measures of a random variable are its **expected value** and **variance**. The expected value represents the long-run average, while the variance measures how spread out the outcomes are. These metrics are critical for evaluating models and comparing predictions.
40+
41+
Mastering probability theory enables data scientists to better interpret model outputs and reason about uncertainty in real-world applications.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
author_profile: false
3+
categories:
4+
- Data Science
5+
classes: wide
6+
date: '2020-11-10'
7+
excerpt: Understand how simple linear regression models the relationship between two variables using a single predictor.
8+
header:
9+
image: /assets/images/data_science_11.jpg
10+
og_image: /assets/images/data_science_11.jpg
11+
overlay_image: /assets/images/data_science_11.jpg
12+
show_overlay_excerpt: false
13+
teaser: /assets/images/data_science_11.jpg
14+
twitter_image: /assets/images/data_science_11.jpg
15+
keywords:
16+
- Linear regression
17+
- Least squares
18+
- Data analysis
19+
seo_description: Discover the mechanics of simple linear regression and how to interpret slope and intercept when fitting a straight line to data.
20+
seo_title: 'A Primer on Simple Linear Regression'
21+
seo_type: article
22+
summary: This article introduces simple linear regression and the least squares method, showing how a single predictor explains variation in a response variable.
23+
tags:
24+
- Regression
25+
- Statistics
26+
- Data science
27+
title: 'A Primer on Simple Linear Regression'
28+
---
29+
30+
Simple linear regression is a foundational technique for modeling the relationship between a predictor variable and a response variable. By fitting a straight line, we can quantify how changes in one variable are associated with changes in another.
31+
32+
## The Least Squares Method
33+
34+
The most common approach to estimating the regression line is **ordinary least squares (OLS)**. OLS finds the line that minimizes the sum of squared residuals between the observed data points and the line's predictions. The slope indicates the strength and direction of the relationship, while the intercept shows the expected value when the predictor is zero.
35+
36+
Understanding simple linear regression is a stepping stone toward more complex modeling techniques, providing crucial intuition about correlation and causation.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
author_profile: false
3+
categories:
4+
- Statistics
5+
classes: wide
6+
date: '2020-11-20'
7+
excerpt: Explore the fundamentals of Bayesian inference and how prior beliefs combine with data to form posterior conclusions.
8+
header:
9+
image: /assets/images/data_science_12.jpg
10+
og_image: /assets/images/data_science_12.jpg
11+
overlay_image: /assets/images/data_science_12.jpg
12+
show_overlay_excerpt: false
13+
teaser: /assets/images/data_science_12.jpg
14+
twitter_image: /assets/images/data_science_12.jpg
15+
keywords:
16+
- Bayesian statistics
17+
- Priors
18+
- Posterior distributions
19+
- Data science
20+
seo_description: An overview of Bayesian inference, demonstrating how to update prior beliefs with new evidence to make data-driven decisions.
21+
seo_title: 'Bayesian Inference Explained'
22+
seo_type: article
23+
summary: Learn how Bayesian inference updates prior beliefs into posterior distributions, providing a flexible framework for reasoning under uncertainty.
24+
tags:
25+
- Bayesian
26+
- Inference
27+
- Statistics
28+
title: 'Bayesian Inference Explained'
29+
---
30+
31+
Bayesian inference offers a powerful perspective on probability, treating unknown quantities as distributions that update when new evidence appears.
32+
33+
## Priors and Posteriors
34+
35+
The process begins with a **prior distribution** that captures our initial beliefs about a parameter. After observing data, we apply Bayes' theorem to obtain the **posterior distribution**, reflecting how our beliefs should change.
36+
37+
## Why Use Bayesian Methods?
38+
39+
Bayesian techniques are particularly useful when data is scarce or when incorporating domain knowledge is essential. They provide a coherent approach to uncertainty that can complement or outperform classical methods in many situations.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
author_profile: false
3+
categories:
4+
- Statistics
5+
classes: wide
6+
date: '2020-11-25'
7+
excerpt: See how hypothesis testing helps draw meaningful conclusions from data in practical scenarios.
8+
header:
9+
image: /assets/images/data_science_13.jpg
10+
og_image: /assets/images/data_science_13.jpg
11+
overlay_image: /assets/images/data_science_13.jpg
12+
show_overlay_excerpt: false
13+
teaser: /assets/images/data_science_13.jpg
14+
twitter_image: /assets/images/data_science_13.jpg
15+
keywords:
16+
- Hypothesis testing
17+
- P-values
18+
- Significance
19+
- Data science
20+
seo_description: Learn how to apply hypothesis tests in real-world analyses and avoid common pitfalls when interpreting p-values and confidence levels.
21+
seo_title: 'Applying Hypothesis Testing in the Real World'
22+
seo_type: article
23+
summary: This post walks through frequentist hypothesis testing, showing how to formulate null and alternative hypotheses and interpret the results in practical data science tasks.
24+
tags:
25+
- Hypothesis testing
26+
- Statistics
27+
- Experiments
28+
title: 'Applying Hypothesis Testing in the Real World'
29+
---
30+
31+
Hypothesis testing allows data scientists to objectively assess whether an observed pattern is likely due to chance or reflects a genuine effect.
32+
33+
## Null vs. Alternative Hypotheses
34+
35+
Every test starts with a **null hypothesis**, representing the status quo, and an **alternative hypothesis**, representing a potential effect. By choosing a significance level and calculating a p-value, we can decide whether to reject the null hypothesis.
36+
37+
## Common Pitfalls
38+
39+
Misinterpreting p-values or failing to consider effect sizes can lead to misguided conclusions. Always pair statistical significance with domain context to ensure results are meaningful.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
author_profile: false
3+
categories:
4+
- Data Science
5+
classes: wide
6+
date: '2020-11-30'
7+
excerpt: Discover best practices for creating clear and compelling data visualizations that communicate insights effectively.
8+
header:
9+
image: /assets/images/data_science_14.jpg
10+
og_image: /assets/images/data_science_14.jpg
11+
overlay_image: /assets/images/data_science_14.jpg
12+
show_overlay_excerpt: false
13+
teaser: /assets/images/data_science_14.jpg
14+
twitter_image: /assets/images/data_science_14.jpg
15+
keywords:
16+
- Data visualization
17+
- Charts
18+
- Communication
19+
- Best practices
20+
seo_description: Guidelines for selecting chart types, choosing colors, and avoiding clutter when visualizing data for stakeholders.
21+
seo_title: 'Data Visualization Best Practices'
22+
seo_type: article
23+
summary: Learn how to design effective visualizations by focusing on clarity, appropriate chart selection, and thoughtful use of color and labels.
24+
tags:
25+
- Visualization
26+
- Data science
27+
- Communication
28+
title: 'Data Visualization Best Practices'
29+
---
30+
31+
Effective data visualization bridges the gap between complex datasets and human understanding. Following proven design principles ensures that your charts highlight the important messages without distractions.
32+
33+
## Choosing the Right Chart
34+
35+
Different data types call for different chart styles. Use bar charts for comparisons, line charts for trends, and scatter plots for relationships. Avoid pie charts when precise comparisons are needed.
36+
37+
## Keep It Simple
38+
39+
Cluttered visuals can obscure the message. Limit the number of colors and remove unnecessary grid lines or 3D effects. Focus the audience's attention on the key insights.
40+
41+
Clear and concise visualizations help stakeholders grasp findings quickly, making your analyses more persuasive and actionable.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
author_profile: false
3+
categories:
4+
- Data Science
5+
classes: wide
6+
date: '2021-10-05'
7+
excerpt: Learn how to design robust data preprocessing pipelines that prepare raw data for modeling.
8+
header:
9+
image: /assets/images/data_science_6.jpg
10+
og_image: /assets/images/data_science_6.jpg
11+
overlay_image: /assets/images/data_science_6.jpg
12+
show_overlay_excerpt: false
13+
teaser: /assets/images/data_science_6.jpg
14+
twitter_image: /assets/images/data_science_6.jpg
15+
keywords:
16+
- Data preprocessing
17+
- Pipelines
18+
- Data cleaning
19+
- Feature engineering
20+
seo_description: Discover best practices for building reusable data preprocessing pipelines that handle missing values, encoding, and feature scaling.
21+
seo_title: Building Data Preprocessing Pipelines for Reliable Models
22+
seo_type: article
23+
summary: This post outlines the key steps in constructing data preprocessing pipelines using tools like scikit-learn to ensure consistent model inputs.
24+
tags:
25+
- Data preprocessing
26+
- Machine learning
27+
- Feature engineering
28+
title: Designing Effective Data Preprocessing Pipelines
29+
---
30+
31+
Real-world datasets rarely come perfectly formatted for modeling. A well-designed **data preprocessing pipeline** ensures that you apply the same transformations consistently across training and production environments.
32+
33+
## Handling Missing Values
34+
35+
Start by assessing the extent of missing data. Common strategies include dropping incomplete rows, filling numeric columns with the mean or median, and using the most frequent category for categorical features.
36+
37+
## Encoding Categorical Variables
38+
39+
Many machine learning algorithms require numeric inputs. Techniques like **one-hot encoding** or **ordinal encoding** convert categories into numbers. Scikit-learn's `ColumnTransformer` allows you to apply different encoders to different columns in a single pipeline.
40+
41+
## Scaling and Normalization
42+
43+
Scaling features to a common range prevents variables with large magnitudes from dominating a model. Standardization (mean of zero, unit variance) is typical for linear models, while min-max scaling keeps values between 0 and 1.
44+
45+
## Putting It All Together
46+
47+
Use scikit-learn's `Pipeline` to chain preprocessing steps with your model. This approach guarantees that the exact same transformations are applied when predicting on new data, reducing the risk of data leakage and improving reproducibility.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
author_profile: false
3+
categories:
4+
- Machine Learning
5+
classes: wide
6+
date: '2021-10-15'
7+
excerpt: Understand how decision tree algorithms split data and how pruning improves generalization.
8+
header:
9+
image: /assets/images/data_science_7.jpg
10+
og_image: /assets/images/data_science_7.jpg
11+
overlay_image: /assets/images/data_science_7.jpg
12+
show_overlay_excerpt: false
13+
teaser: /assets/images/data_science_7.jpg
14+
twitter_image: /assets/images/data_science_7.jpg
15+
keywords:
16+
- Decision trees
17+
- Classification
18+
- Tree pruning
19+
- Machine learning
20+
seo_description: Learn the mechanics of decision tree algorithms, including entropy-based splits and pruning techniques that prevent overfitting.
21+
seo_title: How Decision Trees Work and Why Pruning Matters
22+
seo_type: article
23+
summary: This article walks through the basics of decision tree construction and explains common pruning methods to create better models.
24+
tags:
25+
- Decision trees
26+
- Classification
27+
- Overfitting
28+
title: Demystifying Decision Tree Algorithms
29+
---
30+
31+
Decision trees are intuitive models that recursively split data into smaller groups based on feature values. Each split aims to maximize homogeneity within branches while separating different classes.
32+
33+
## Choosing the Best Split
34+
35+
Metrics like **Gini impurity** and **entropy** measure how mixed the classes are in each node. The algorithm searches over possible splits and selects the one that yields the largest reduction in impurity.
36+
37+
## Preventing Overfitting
38+
39+
A tree grown until every leaf is pure often memorizes the training data. **Pruning** removes branches that provide little predictive power, leading to a simpler tree that generalizes better to new samples.
40+
41+
## When to Use Decision Trees
42+
43+
Decision trees handle both numeric and categorical features and require minimal data preparation. They also serve as the building blocks for powerful ensemble methods like random forests and gradient boosting.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
author_profile: false
3+
categories:
4+
- Machine Learning
5+
classes: wide
6+
date: '2021-11-10'
7+
excerpt: Explore key metrics for evaluating classification and regression models.
8+
header:
9+
image: /assets/images/data_science_8.jpg
10+
og_image: /assets/images/data_science_8.jpg
11+
overlay_image: /assets/images/data_science_8.jpg
12+
show_overlay_excerpt: false
13+
teaser: /assets/images/data_science_8.jpg
14+
twitter_image: /assets/images/data_science_8.jpg
15+
keywords:
16+
- Model evaluation
17+
- Accuracy
18+
- Precision
19+
- Recall
20+
- Regression metrics
21+
seo_description: A concise overview of essential metrics like precision, recall, F1-score, and RMSE for measuring model performance.
22+
seo_title: Essential Metrics for Evaluating Machine Learning Models
23+
seo_type: article
24+
summary: Learn how to interpret common classification and regression metrics to choose the best model for your data.
25+
tags:
26+
- Accuracy
27+
- F1-score
28+
- RMSE
29+
title: A Guide to Model Evaluation Metrics
30+
---
31+
32+
Choosing the right evaluation metric is critical for comparing models and selecting the best one for your problem.
33+
34+
## Classification Metrics
35+
36+
- **Accuracy** measures the fraction of correct predictions. It works well when classes are balanced but can be misleading with imbalanced datasets.
37+
- **Precision** and **recall** capture how well the model retrieves relevant instances without producing too many false positives or negatives. The **F1-score** provides a balance between the two.
38+
39+
## Regression Metrics
40+
41+
- **Mean Absolute Error (MAE)** evaluates the average magnitude of errors.
42+
- **Root Mean Squared Error (RMSE)** penalizes larger errors more heavily, making it useful when large deviations are particularly undesirable.
43+
44+
Selecting evaluation metrics that align with business goals will help you make informed decisions about which model to deploy.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
author_profile: false
3+
categories:
4+
- Data Science
5+
- Time Series
6+
classes: wide
7+
date: '2022-10-15'
8+
excerpt: Learn how time series decomposition reveals trend, seasonality, and residual components for clearer forecasting insights.
9+
header:
10+
image: /assets/images/data_science_12.jpg
11+
og_image: /assets/images/data_science_12.jpg
12+
overlay_image: /assets/images/data_science_12.jpg
13+
show_overlay_excerpt: false
14+
teaser: /assets/images/data_science_12.jpg
15+
twitter_image: /assets/images/data_science_12.jpg
16+
keywords:
17+
- Time series
18+
- Trend
19+
- Seasonality
20+
- Forecasting
21+
- Decomposition
22+
seo_description: Discover how to separate trend and seasonal patterns from a time series using additive or multiplicative decomposition.
23+
seo_title: 'Time Series Decomposition Made Simple'
24+
seo_type: article
25+
summary: This article explains how decomposing a time series helps isolate long-term trends and recurring seasonal effects so you can model data more effectively.
26+
tags:
27+
- Time series
28+
- Forecasting
29+
- Data analysis
30+
- Python
31+
title: 'Time Series Decomposition: Separating Trend and Seasonality'
32+
---
33+
34+
Time series data often combine several underlying components: a long-term **trend**, repeating **seasonal** patterns, and random **residual** noise. By decomposing a series into these pieces, you can better understand its behavior and build more accurate forecasts.
35+
36+
## Additive vs. Multiplicative Models
37+
38+
In an **additive** model, the components simply add together:
39+
40+
$$ y_t = T_t + S_t + R_t $$
41+
42+
where $T_t$ is the trend, $S_t$ is the seasonal component, and $R_t$ represents the residuals. A **multiplicative** model instead multiplies these terms:
43+
44+
$$ y_t = T_t \times S_t \times R_t $$
45+
46+
Choose the form that best fits the scale of seasonal fluctuations in your data.
47+
48+
## Extracting the Components
49+
50+
Python libraries like `statsmodels` or `pandas` offer built-in functions to perform decomposition. Once the trend and seasonality are isolated, you can analyze them separately or remove them before applying forecasting models such as ARIMA.
51+
52+
Understanding each component allows you to explain past observations and produce more transparent predictions for future values.

0 commit comments

Comments
 (0)