<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jonathan kip</title>
    <description>The latest articles on DEV Community by Jonathan kip (@jonathan_kip).</description>
    <link>https://dev.to/jonathan_kip</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3818256%2Fb571412d-15c8-4cfa-97c0-0622f4169297.jpg</url>
      <title>DEV Community: Jonathan kip</title>
      <link>https://dev.to/jonathan_kip</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jonathan_kip"/>
    <language>en</language>
    <item>
      <title>How machines learn to see, interpret, and understand images</title>
      <dc:creator>Jonathan kip</dc:creator>
      <pubDate>Mon, 21 Sep 2026 10:13:40 +0000</pubDate>
      <link>https://dev.to/jonathan_kip/how-machines-learn-to-see-interpret-and-understand-images-jkm</link>
      <guid>https://dev.to/jonathan_kip/how-machines-learn-to-see-interpret-and-understand-images-jkm</guid>
      <description>&lt;h2&gt;
  
  
  Understanding Convolutional Neural Networks and Computer Vision
&lt;/h2&gt;

&lt;p&gt;Computer Vision is a field of Artificial Intelligence (AI) that enables computers to process and interpret visual information from images and videos.&lt;/p&gt;

&lt;p&gt;It powers applications such as facial recognition, medical imaging, autonomous vehicles, security systems, OCR, and image search.&lt;/p&gt;

&lt;p&gt;One of the most important technologies behind modern Computer Vision is the &lt;strong&gt;Convolutional Neural Network (CNN)&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Computer Vision?
&lt;/h2&gt;

&lt;p&gt;Computers do not see images the way humans do. An image is represented as numerical values called &lt;strong&gt;pixels&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A grayscale image typically has one channel, while an RGB image has three:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Red&lt;/li&gt;
&lt;li&gt;Green&lt;/li&gt;
&lt;li&gt;Blue&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An RGB image can therefore be represented as:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;H × W × C&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;H&lt;/strong&gt; = height&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;W&lt;/strong&gt; = width&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;C&lt;/strong&gt; = number of channels&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;224 × 224 × 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;represents an image that is 224 pixels high, 224 pixels wide, and has three color channels.&lt;/p&gt;

&lt;p&gt;Computer Vision algorithms process these values to identify patterns and produce meaningful results.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Computer Vision Tasks
&lt;/h3&gt;

&lt;p&gt;Some common tasks include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Image classification&lt;/strong&gt; — assigning a label to an image.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Object detection&lt;/strong&gt; — identifying objects and their locations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image segmentation&lt;/strong&gt; — classifying individual pixels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Face recognition&lt;/strong&gt; — identifying or verifying faces.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optical Character Recognition (OCR)&lt;/strong&gt; — extracting text from images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pose estimation&lt;/strong&gt; — detecting body positions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Video analysis&lt;/strong&gt; — understanding movement across frames.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, classification might tell us that an image contains a &lt;strong&gt;dog&lt;/strong&gt;, while object detection can identify several dogs and locate each one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is a CNN?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Convolutional Neural Network&lt;/strong&gt; is a deep-learning architecture designed to process grid-like data, especially images.&lt;/p&gt;

&lt;p&gt;A traditional fully connected neural network can become computationally expensive when processing images because every pixel may be connected to many neurons.&lt;/p&gt;

&lt;p&gt;CNNs solve this problem by processing &lt;strong&gt;local regions&lt;/strong&gt; of an image using learnable filters, also called &lt;strong&gt;kernels&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A typical CNN contains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input Image
     ↓
Convolution
     ↓
Activation Function
     ↓
Pooling / Downsampling
     ↓
More Convolution Layers
     ↓
Prediction Layer
     ↓
Output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The key advantage is that CNNs &lt;strong&gt;learn useful visual features automatically&lt;/strong&gt; rather than requiring us to manually define them.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Convolution Works
&lt;/h2&gt;

&lt;p&gt;A convolutional filter is a small matrix that moves across an image.&lt;/p&gt;

&lt;p&gt;At each position, the filter performs element-wise multiplication with the image region and sums the results. This produces a &lt;strong&gt;feature map&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A simplified convolution can be represented as:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Y(i, j) = Σₘ Σₙ X(i + m, j + n)K(m, n)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;X&lt;/strong&gt; = input image or feature map&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;K&lt;/strong&gt; = convolutional kernel&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Y(i, j)&lt;/strong&gt; = output value at position &lt;code&gt;(i, j)&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;During training, the CNN learns the values of these filters.&lt;/p&gt;

&lt;p&gt;Some filters may learn to detect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Edges&lt;/li&gt;
&lt;li&gt;Corners&lt;/li&gt;
&lt;li&gt;Curves&lt;/li&gt;
&lt;li&gt;Textures&lt;/li&gt;
&lt;li&gt;Shapes&lt;/li&gt;
&lt;li&gt;Object parts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This leads to one of the most important concepts in CNNs: &lt;strong&gt;hierarchical feature learning&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The CNN Feature Hierarchy
&lt;/h2&gt;

&lt;p&gt;CNNs generally learn increasingly complex features as information moves through the network.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Typical Features&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Early&lt;/td&gt;
&lt;td&gt;Edges, colors, textures&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Middle&lt;/td&gt;
&lt;td&gt;Curves, shapes, patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deep&lt;/td&gt;
&lt;td&gt;Eyes, wheels, windows, object parts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Final&lt;/td&gt;
&lt;td&gt;Complete objects or categories&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For example, in a cat-classification model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Pixels
  ↓
Edges
  ↓
Textures and shapes
  ↓
Eyes, ears, fur
  ↓
Cat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The network learns this hierarchy automatically from training data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Activation Functions
&lt;/h2&gt;

&lt;p&gt;After convolution, CNNs typically apply an activation function to introduce &lt;strong&gt;nonlinearity&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;One of the most common is the &lt;strong&gt;Rectified Linear Unit (ReLU)&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ReLU(x) = max(0, x)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ReLU(-5) = 0
ReLU( 7) = 7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ReLU allows neural networks to learn complex relationships that cannot be represented using only linear operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Padding and Stride
&lt;/h2&gt;

&lt;p&gt;Two important convolution parameters are &lt;strong&gt;padding&lt;/strong&gt; and &lt;strong&gt;stride&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Padding&lt;/strong&gt; adds pixels around the border of an image. It can help preserve spatial dimensions and ensure that border information is processed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stride&lt;/strong&gt; determines how far the filter moves during convolution.&lt;/p&gt;

&lt;p&gt;The output size can be calculated using:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output size = floor((N − F + 2P) / S) + 1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;N&lt;/strong&gt; = input size&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;F&lt;/strong&gt; = filter size&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;P&lt;/strong&gt; = padding&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;S&lt;/strong&gt; = stride&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, with a 32 × 32 input, a 3 × 3 filter, padding of 1, and stride of 1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Output = floor((32 − 3 + 2) / 1) + 1
       = 32
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The spatial dimensions therefore remain 32 × 32.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pooling
&lt;/h2&gt;

&lt;p&gt;Pooling reduces the spatial size of feature maps.&lt;/p&gt;

&lt;p&gt;The two common types are &lt;strong&gt;max pooling&lt;/strong&gt; and &lt;strong&gt;average pooling&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Max Pooling
&lt;/h3&gt;

&lt;p&gt;Max pooling selects the largest value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[1  3]
[2  4] → 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Average Pooling
&lt;/h3&gt;

&lt;p&gt;Average pooling calculates the average:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[1  3]
[2  4] → 2.5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pooling reduces computational requirements and can make models less sensitive to small changes in object position.&lt;/p&gt;

&lt;p&gt;However, excessive downsampling can remove useful spatial information, which is why some modern architectures use other downsampling techniques.&lt;/p&gt;

&lt;h2&gt;
  
  
  How CNNs Learn
&lt;/h2&gt;

&lt;p&gt;CNN training involves repeatedly making predictions and correcting errors.&lt;/p&gt;

&lt;p&gt;The process is roughly:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pass an image through the network.&lt;/li&gt;
&lt;li&gt;Generate a prediction.&lt;/li&gt;
&lt;li&gt;Calculate the loss.&lt;/li&gt;
&lt;li&gt;Use backpropagation to calculate gradients.&lt;/li&gt;
&lt;li&gt;Update the model's parameters.&lt;/li&gt;
&lt;li&gt;Repeat over many batches and epochs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For multiclass classification, a common loss function is &lt;strong&gt;cross-entropy&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;L = −Σᵢ yᵢ log(ŷᵢ)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A simplified gradient-descent update is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;θₜ₊₁ = θₜ − η∇θL&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;θ&lt;/strong&gt; = model parameters&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;η&lt;/strong&gt; = learning rate&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;∇θL&lt;/strong&gt; = gradient of the loss&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Over many training iterations, the network learns filters that produce better predictions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Softmax and Classification
&lt;/h2&gt;

&lt;p&gt;For a classification problem, the final layer can produce a score for each class.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;softmax&lt;/strong&gt; function converts these scores into probabilities:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;P(y = i | x) = eᶻⁱ / Σⱼ eᶻʲ&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cat:    0.82
Dog:    0.12
Rabbit: 0.06
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model predicts &lt;strong&gt;Cat&lt;/strong&gt; because it has the highest probability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Training, Overfitting, and Generalization
&lt;/h2&gt;

&lt;p&gt;CNNs require representative training data.&lt;/p&gt;

&lt;p&gt;For a vehicle-recognition model, the dataset should ideally contain vehicles under different:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lighting conditions&lt;/li&gt;
&lt;li&gt;Viewing angles&lt;/li&gt;
&lt;li&gt;Backgrounds&lt;/li&gt;
&lt;li&gt;Weather conditions&lt;/li&gt;
&lt;li&gt;Resolutions&lt;/li&gt;
&lt;li&gt;Levels of obstruction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If a model performs extremely well on training data but poorly on unseen data, it may be &lt;strong&gt;overfitting&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A model that performs well on unseen data is said to &lt;strong&gt;generalize&lt;/strong&gt; effectively.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Augmentation
&lt;/h3&gt;

&lt;p&gt;Data augmentation can improve generalization by creating variations of existing images.&lt;/p&gt;

&lt;p&gt;Common techniques include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flipping&lt;/li&gt;
&lt;li&gt;Cropping&lt;/li&gt;
&lt;li&gt;Rotation&lt;/li&gt;
&lt;li&gt;Scaling&lt;/li&gt;
&lt;li&gt;Translation&lt;/li&gt;
&lt;li&gt;Brightness adjustment&lt;/li&gt;
&lt;li&gt;Contrast adjustment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, a dog image can be flipped, slightly rotated, or cropped to create additional training examples.&lt;/p&gt;

&lt;p&gt;The transformations should remain realistic. An inappropriate transformation can change the meaning of an image and confuse the model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Transfer Learning
&lt;/h2&gt;

&lt;p&gt;Training a CNN from scratch can require substantial data and computational resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transfer learning&lt;/strong&gt; provides a practical alternative.&lt;/p&gt;

&lt;p&gt;A pretrained model has already learned general visual features such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Edges → Textures → Shapes → Object parts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These learned features can be reused for a new task.&lt;/p&gt;

&lt;p&gt;Transfer learning is particularly useful when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The dataset is small.&lt;/li&gt;
&lt;li&gt;Computing resources are limited.&lt;/li&gt;
&lt;li&gt;Training time needs to be reduced.&lt;/li&gt;
&lt;li&gt;The new task is related to the original training task.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  CNN Applications
&lt;/h2&gt;

&lt;p&gt;CNNs are used across many areas of Computer Vision.&lt;/p&gt;

&lt;h3&gt;
  
  
  Image Classification
&lt;/h3&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Animal classification&lt;/li&gt;
&lt;li&gt;Traffic-sign recognition&lt;/li&gt;
&lt;li&gt;Handwritten-digit recognition&lt;/li&gt;
&lt;li&gt;Medical image classification&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Object Detection
&lt;/h3&gt;

&lt;p&gt;Object detection identifies objects and their locations.&lt;/p&gt;

&lt;p&gt;A system might produce:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Person: 0.96
Bounding box: (x1, y1, x2, y2)

Bicycle: 0.91
Bounding box: (x1, y1, x2, y2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is useful in robotics, autonomous systems, surveillance, and retail analytics.&lt;/p&gt;

&lt;h3&gt;
  
  
  Image Segmentation
&lt;/h3&gt;

&lt;p&gt;Segmentation assigns labels to individual pixels.&lt;/p&gt;

&lt;p&gt;Applications include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Medical imaging&lt;/li&gt;
&lt;li&gt;Autonomous driving&lt;/li&gt;
&lt;li&gt;Satellite imagery&lt;/li&gt;
&lt;li&gt;Industrial inspection&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Facial Analysis
&lt;/h3&gt;

&lt;p&gt;CNNs can be used for face detection, verification, and recognition.&lt;/p&gt;

&lt;p&gt;However, these systems require careful consideration of privacy, consent, security, and fairness.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evaluating CNN Models
&lt;/h2&gt;

&lt;p&gt;Different Computer Vision tasks require different evaluation metrics.&lt;/p&gt;

&lt;p&gt;For classification, common metrics include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accuracy&lt;/li&gt;
&lt;li&gt;Precision&lt;/li&gt;
&lt;li&gt;Recall&lt;/li&gt;
&lt;li&gt;F1 score&lt;/li&gt;
&lt;li&gt;Top-&lt;em&gt;k&lt;/em&gt; accuracy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For object detection, &lt;strong&gt;Intersection over Union (IoU)&lt;/strong&gt; measures the overlap between a predicted bounding box and the ground-truth box:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IoU = Area of Intersection / Area of Union&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;IoU ranges from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 → No overlap
1 → Perfect overlap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For segmentation, commonly used metrics include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pixel accuracy&lt;/li&gt;
&lt;li&gt;IoU&lt;/li&gt;
&lt;li&gt;Dice coefficient&lt;/li&gt;
&lt;li&gt;Mean IoU&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Accuracy should not always be used alone. For example, in a medical-diagnosis application, false negatives may be particularly important.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limitations of CNNs
&lt;/h2&gt;

&lt;p&gt;CNNs are powerful, but they have limitations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Dependence
&lt;/h3&gt;

&lt;p&gt;A model can struggle when it encounters conditions that are significantly different from its training data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dataset Bias
&lt;/h3&gt;

&lt;p&gt;Unbalanced or incomplete datasets can cause differences in model performance across groups or environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adversarial Inputs
&lt;/h3&gt;

&lt;p&gt;Small changes to an image can sometimes cause a model to produce an incorrect prediction.&lt;/p&gt;

&lt;h3&gt;
  
  
  Interpretability
&lt;/h3&gt;

&lt;p&gt;CNNs can be difficult to interpret because their learned representations are distributed across many layers and parameters.&lt;/p&gt;

&lt;p&gt;Techniques such as &lt;strong&gt;Grad-CAM&lt;/strong&gt; can help visualize which image regions influenced a prediction.&lt;/p&gt;

&lt;h3&gt;
  
  
  Computational Requirements
&lt;/h3&gt;

&lt;p&gt;Large CNNs can require significant memory and processing power.&lt;/p&gt;

&lt;p&gt;Techniques such as &lt;strong&gt;quantization, pruning, model compression, and efficient architectures&lt;/strong&gt; can help make models more suitable for edge devices.&lt;/p&gt;

&lt;h2&gt;
  
  
  CNNs and Modern Vision Models
&lt;/h2&gt;

&lt;p&gt;CNNs remain important, but modern Computer Vision is expanding beyond convolutional architectures.&lt;/p&gt;

&lt;p&gt;Other approaches include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Vision Transformers (ViTs)&lt;/li&gt;
&lt;li&gt;Attention mechanisms&lt;/li&gt;
&lt;li&gt;Generative models&lt;/li&gt;
&lt;li&gt;Multimodal models&lt;/li&gt;
&lt;li&gt;CNN-transformer hybrid architectures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CNNs are particularly good at learning local visual patterns, while transformer-based models can capture relationships between distant regions of an image.&lt;/p&gt;

&lt;p&gt;Many modern systems combine ideas from both approaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Computer Vision enables machines to process and interpret visual information, while &lt;strong&gt;Convolutional Neural Networks provide a powerful way to learn visual features directly from image data&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;CNNs progressively transform raw pixels into increasingly meaningful representations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Pixels
  ↓
Edges
  ↓
Textures
  ↓
Shapes
  ↓
Object Parts
  ↓
Objects
  ↓
Prediction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Understanding convolution, activation functions, pooling, backpropagation, training data, and evaluation provides a strong foundation for working with Computer Vision.&lt;/p&gt;

&lt;p&gt;CNNs are not the end of Computer Vision, but they remain an important foundation for understanding how modern visual AI systems work.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you found this article useful, consider following for more articles about machine learning, deep learning, and computer vision.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>computerscience</category>
      <category>deeplearning</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Neural Networks: Inspiration and Main Components</title>
      <dc:creator>Jonathan kip</dc:creator>
      <pubDate>Mon, 21 Sep 2026 09:02:19 +0000</pubDate>
      <link>https://dev.to/jonathan_kip/neural-networks-inspiration-and-main-components-2bpl</link>
      <guid>https://dev.to/jonathan_kip/neural-networks-inspiration-and-main-components-2bpl</guid>
      <description>&lt;h2&gt;
  
  
  Neural Networks: Inspiration and Main Components
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;neural network&lt;/strong&gt; is a computer model that learns from examples. It is inspired by the human brain, where interconnected biological neurons receive information, process it, and send signals to one another. In artificial intelligence, neural networks use mathematical calculations to recognize patterns, make predictions, and support decision-making.&lt;/p&gt;

&lt;p&gt;Although neural networks are inspired by the brain, they are not exact copies of biological neurons. They are simplified computational systems made up of connected processing units called &lt;strong&gt;artificial neurons&lt;/strong&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  Biological Inspiration
&lt;/h2&gt;

&lt;p&gt;The human brain contains many biological neurons connected through junctions called synapses. A neuron receives signals through its dendrites, processes them in the cell body, and sends signals through its axon.&lt;/p&gt;

&lt;p&gt;Artificial neural networks simplify this process:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Biological brain&lt;/th&gt;
&lt;th&gt;Artificial neural network&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Biological neuron&lt;/td&gt;
&lt;td&gt;Artificial neuron&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dendrites receive signals&lt;/td&gt;
&lt;td&gt;Inputs receive data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Synapse strength&lt;/td&gt;
&lt;td&gt;Weight&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cell-body processing&lt;/td&gt;
&lt;td&gt;Mathematical calculation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Neuron firing&lt;/td&gt;
&lt;td&gt;Activation output&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Learning through experience&lt;/td&gt;
&lt;td&gt;Adjusting weights&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The main idea is that many simple units can work together to solve complicated problems. Artificial neural networks use this idea to learn patterns from data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Structure of a Neural Network
&lt;/h2&gt;

&lt;p&gt;A neural network is normally organized into layers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Input layer&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hidden layer or layers&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Output layer&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Information moves through these layers until the network produces a prediction.&lt;/p&gt;

&lt;h3&gt;
  
  
  Input Layer
&lt;/h3&gt;

&lt;p&gt;The input layer receives the information used by the network. Each input represents a feature.&lt;/p&gt;

&lt;p&gt;For example, a network predicting whether a student will pass may receive:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hours studied.&lt;/li&gt;
&lt;li&gt;Attendance percentage.&lt;/li&gt;
&lt;li&gt;Previous examination marks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In an image-recognition system, the inputs may represent pixel values.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hidden Layers
&lt;/h3&gt;

&lt;p&gt;Hidden layers process the information received from the input layer. They identify relationships and patterns within the data.&lt;/p&gt;

&lt;p&gt;For example, when identifying an image:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One layer may detect lines.&lt;/li&gt;
&lt;li&gt;Another layer may detect shapes.&lt;/li&gt;
&lt;li&gt;A later layer may detect parts of an object.&lt;/li&gt;
&lt;li&gt;The final hidden layers may recognize the complete object.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A neural network with many hidden layers is called a &lt;strong&gt;deep neural network&lt;/strong&gt;, while the use of these networks is generally referred to as &lt;strong&gt;deep learning&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Output Layer
&lt;/h3&gt;

&lt;p&gt;The output layer gives the final answer.&lt;/p&gt;

&lt;p&gt;For example, a network classifying an image may produce:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Class&lt;/th&gt;
&lt;th&gt;Probability&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cat&lt;/td&gt;
&lt;td&gt;0.85&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dog&lt;/td&gt;
&lt;td&gt;0.15&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The network would classify the image as a cat because it has the higher probability.&lt;/p&gt;

&lt;p&gt;The output layer can produce different types of results:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A yes-or-no answer.&lt;/li&gt;
&lt;li&gt;A category among several choices.&lt;/li&gt;
&lt;li&gt;A numerical value, such as a price or temperature.&lt;/li&gt;
&lt;li&gt;Several values for a multi-output prediction.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Artificial Neuron
&lt;/h2&gt;

&lt;p&gt;An artificial neuron receives input values and combines them to produce an output. It does this using &lt;strong&gt;weights&lt;/strong&gt;, a &lt;strong&gt;bias&lt;/strong&gt;, and an &lt;strong&gt;activation function&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The basic calculation is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;z = w₁x₁ + w₂x₂ + ... + wₙxₙ + b
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The neuron then applies an activation function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
a = f(z)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In simple terms, the neuron:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Receives information.&lt;/li&gt;
&lt;li&gt;Determines the importance of each input.&lt;/li&gt;
&lt;li&gt;Combines the inputs.&lt;/li&gt;
&lt;li&gt;Adds a bias.&lt;/li&gt;
&lt;li&gt;Produces an output.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Inputs
&lt;/h3&gt;

&lt;p&gt;Inputs are the data given to the neural network. They can be numbers, words, sounds, or images.&lt;/p&gt;

&lt;h3&gt;
  
  
  Weights
&lt;/h3&gt;

&lt;p&gt;Weights determine the importance of different inputs. A large positive weight means that an input has a strong positive influence. A negative weight can reduce or reverse the influence of an input.&lt;/p&gt;

&lt;p&gt;For example, in a spam-detection model, words such as “free” or “prize” may receive important weights if they frequently occur in spam emails.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bias
&lt;/h3&gt;

&lt;p&gt;A bias is an additional value that makes the neuron more flexible. It helps the neuron adjust its output even when the input values are small or zero.&lt;/p&gt;

&lt;h3&gt;
  
  
  Activation Functions
&lt;/h3&gt;

&lt;p&gt;An activation function controls the output of a neuron. It also allows the neural network to learn complex, non-linear patterns rather than only simple relationships.&lt;/p&gt;

&lt;p&gt;Common activation functions include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ReLU:&lt;/strong&gt; Produces zero for negative values and keeps positive values.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sigmoid:&lt;/strong&gt; Produces values between 0 and 1 and is often used for probabilities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tanh:&lt;/strong&gt; Produces values between -1 and 1.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Softmax:&lt;/strong&gt; Converts several outputs into probabilities that add up to 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An activation function can be viewed as a decision rule that determines whether a neuron should produce a weak, strong, or zero signal.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Neural Networks Learn
&lt;/h2&gt;

&lt;p&gt;Neural networks learn by studying examples. This process is similar to teaching a student through practice.&lt;/p&gt;

&lt;p&gt;Suppose a neural network is being trained to identify cats and dogs. The training process works as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The network receives an image.&lt;/li&gt;
&lt;li&gt;It makes a prediction.&lt;/li&gt;
&lt;li&gt;The prediction is compared with the correct answer.&lt;/li&gt;
&lt;li&gt;The error is measured.&lt;/li&gt;
&lt;li&gt;The network adjusts its weights.&lt;/li&gt;
&lt;li&gt;It repeats the process with many other examples.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;At the beginning, the network may make many mistakes. Gradually, it changes its weights and learns which patterns are important.&lt;/p&gt;

&lt;h2&gt;
  
  
  Loss and Error
&lt;/h2&gt;

&lt;p&gt;The difference between the network’s prediction and the correct answer is called the &lt;strong&gt;error&lt;/strong&gt; or &lt;strong&gt;loss&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example, if the correct label is “cat” but the network predicts “dog,” the loss function measures how incorrect the prediction was.&lt;/p&gt;

&lt;p&gt;The purpose of training is to reduce the loss. A smaller loss usually means that the network’s predictions are becoming more accurate.&lt;/p&gt;

&lt;p&gt;Common loss functions include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mean squared error:&lt;/strong&gt; Used mainly for numerical predictions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Binary cross-entropy:&lt;/strong&gt; Used for two-class problems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Categorical cross-entropy:&lt;/strong&gt; Used for problems involving several classes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Backpropagation
&lt;/h2&gt;

&lt;p&gt;Once the network calculates its error, it determines which weights contributed to that error. It then sends the error information backward through the network.&lt;/p&gt;

&lt;p&gt;This process is called &lt;strong&gt;backpropagation&lt;/strong&gt;. It calculates how the weights should change so that the network can make better predictions in the future. &lt;/p&gt;

&lt;p&gt;An optimization algorithm, such as gradient descent or Adam, applies these changes.&lt;/p&gt;

&lt;p&gt;The overall learning cycle can be represented as:&lt;/p&gt;

&lt;p&gt;Input → Prediction → Error → Weight adjustment&lt;br&gt;
This cycle is repeated many times during training.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple Example
&lt;/h2&gt;

&lt;p&gt;Consider a neural network designed to predict whether a student will pass an examination.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inputs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Hours studied: 6.&lt;/li&gt;
&lt;li&gt;Attendance: 85%.&lt;/li&gt;
&lt;li&gt;Previous score: 70%.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The input layer receives these values. The hidden layers examine relationships between the features. The weights determine how important each feature is.&lt;/p&gt;

&lt;p&gt;The output layer may produce:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Probability of passing: 0.82&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This means the network estimates an 82% chance that the student will pass. If the student eventually fails, the network uses that incorrect prediction to adjust its weights during training.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Neural Networks
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Feedforward Neural Networks
&lt;/h3&gt;

&lt;p&gt;In a feedforward network, information moves in one direction from the input layer to the output layer. These networks are commonly used for basic classification and regression tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Convolutional Neural Networks
&lt;/h3&gt;

&lt;p&gt;Convolutional neural networks, or CNNs, are designed mainly for image and spatial data. They identify local patterns such as edges, textures, and shapes.&lt;/p&gt;

&lt;p&gt;Applications include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Image classification.&lt;/li&gt;
&lt;li&gt;Object detection.&lt;/li&gt;
&lt;li&gt;Medical-image analysis.&lt;/li&gt;
&lt;li&gt;Satellite-image interpretation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Recurrent Neural Networks
&lt;/h3&gt;

&lt;p&gt;Recurrent neural networks, or RNNs, are designed for sequential information. They can use information from earlier parts of a sequence.&lt;/p&gt;

&lt;p&gt;They have been used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Speech recognition.&lt;/li&gt;
&lt;li&gt;Text processing.&lt;/li&gt;
&lt;li&gt;Time-series forecasting.&lt;/li&gt;
&lt;li&gt;Language translation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Transformers
&lt;/h3&gt;

&lt;p&gt;Transformers use attention mechanisms to determine which parts of an input are most important in relation to other parts. They are widely used in language processing and other modern artificial-intelligence applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Autoencoders
&lt;/h3&gt;

&lt;p&gt;Autoencoders learn to compress information and then reconstruct it. They are useful for dimensionality reduction, noise removal, anomaly detection, and feature learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages and Limitations
&lt;/h2&gt;

&lt;p&gt;Neural networks have several advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They can learn complicated relationships.&lt;/li&gt;
&lt;li&gt;They can process images, text, sound, and numerical data.&lt;/li&gt;
&lt;li&gt;They can automatically discover useful features.&lt;/li&gt;
&lt;li&gt;Their performance may improve with suitable training data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They also have limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They may require a large amount of data.&lt;/li&gt;
&lt;li&gt;Training can require significant computing resources.&lt;/li&gt;
&lt;li&gt;They can learn bias or errors found in the training data.&lt;/li&gt;
&lt;li&gt;Their decisions may be difficult to explain.&lt;/li&gt;
&lt;li&gt;They may perform poorly on unfamiliar examples.&lt;/li&gt;
&lt;li&gt;They can overfit the training data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Neural networks are computer models inspired by the way biological neurons connect and communicate. They are made up of artificial neurons organized into input, hidden, and output layers.&lt;/p&gt;

&lt;p&gt;The main components include inputs, weights, biases, activation functions, neurons, loss functions, and optimization methods. A neural network learns by making predictions, measuring errors, and adjusting its weights through backpropagation.&lt;/p&gt;

&lt;p&gt;In simple terms, a neural network is like a learner that improves through practice. It studies examples, discovers important patterns, learns from its mistakes, and uses what it has learned to make predictions about new data.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Using Scikit-learn Pipelines: A Practical Technical Guide</title>
      <dc:creator>Jonathan kip</dc:creator>
      <pubDate>Mon, 31 Aug 2026 06:26:41 +0000</pubDate>
      <link>https://dev.to/jonathan_kip/using-scikit-learn-pipelines-a-practical-technical-guide-3j31</link>
      <guid>https://dev.to/jonathan_kip/using-scikit-learn-pipelines-a-practical-technical-guide-3j31</guid>
      <description>&lt;p&gt;Think of a scikit-learn Pipeline as a “recipe” for your machine learning workflow: it lists the steps (cleaning, transforming, modeling) in order and runs them automatically every time you train or predict. This keeps your code tidy, prevents mistakes, and makes your models easier to reuse.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Problem Do Pipelines Solve?
&lt;/h2&gt;

&lt;p&gt;Without pipelines, you might:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Impute missing values, then scale, then train a model—using separate commands.&lt;/li&gt;
&lt;li&gt;Accidentally fit preprocessing on the whole dataset (including test data), which leaks information.&lt;/li&gt;
&lt;li&gt;Repeat the same steps for training, validation, and deployment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pipelines fix this by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bundling all steps into one object.&lt;/li&gt;
&lt;li&gt;Ensuring preprocessing is fit only on training data during cross-validation.&lt;/li&gt;
&lt;li&gt;Letting you call &lt;code&gt;fit&lt;/code&gt; and &lt;code&gt;predict&lt;/code&gt; once on the whole workflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Basic Idea: Steps in Order
&lt;/h2&gt;

&lt;p&gt;A pipeline is just an ordered list of named steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.pipeline&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Pipeline&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.preprocessing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;StandardScaler&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.linear_model&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;LogisticRegression&lt;/span&gt;

&lt;span class="n"&gt;pipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pipeline&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;scaler&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;StandardScaler&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;LogisticRegression&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_train&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;y_pred&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_test&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What happens inside:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On &lt;code&gt;fit&lt;/code&gt;: &lt;code&gt;StandardScaler&lt;/code&gt; learns mean and std from &lt;code&gt;X_train&lt;/code&gt;, transforms &lt;code&gt;X_train&lt;/code&gt;, then &lt;code&gt;LogisticRegression&lt;/code&gt; fits on the scaled data.&lt;/li&gt;
&lt;li&gt;On &lt;code&gt;predict&lt;/code&gt;: &lt;code&gt;StandardScaler&lt;/code&gt; transforms &lt;code&gt;X_test&lt;/code&gt; using the training statistics, then &lt;code&gt;LogisticRegression&lt;/code&gt; predicts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You never manually scale test data; the pipeline does it consistently.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Simpler Constructor: make_pipeline
&lt;/h2&gt;

&lt;p&gt;If you don’t care about step names, use &lt;code&gt;make_pipeline&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.pipeline&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;make_pipeline&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.preprocessing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;StandardScaler&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.linear_model&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;LogisticRegression&lt;/span&gt;

&lt;span class="n"&gt;pipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;make_pipeline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;StandardScaler&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nc"&gt;LogisticRegression&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;scikit-learn names the steps automatically (&lt;code&gt;standardscaler&lt;/code&gt;, &lt;code&gt;logisticregression&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Handling Different Column Types: ColumnTransformer
&lt;/h2&gt;

&lt;p&gt;Real data has numeric and categorical columns that need different treatment. &lt;code&gt;ColumnTransformer&lt;/code&gt; lets you apply different preprocessing to different columns, then combines them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.compose&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ColumnTransformer&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.preprocessing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OneHotEncoder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;StandardScaler&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.impute&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SimpleImputer&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.pipeline&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Pipeline&lt;/span&gt;

&lt;span class="n"&gt;numeric_features&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;age&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;income&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;categorical_features&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;city&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;subscription&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;numeric_pipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pipeline&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;imputer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;SimpleImputer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strategy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;median&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;scaler&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;StandardScaler&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;categorical_pipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pipeline&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;imputer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;SimpleImputer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strategy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;most_frequent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;onehot&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;OneHotEncoder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;handle_unknown&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ignore&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;preprocess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ColumnTransformer&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;num&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;numeric_pipe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;numeric_features&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cat&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;categorical_pipe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;categorical_features&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pipeline&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;preprocess&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;preprocess&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;clf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;LogisticRegression&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_train&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;y_pred&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_test&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key idea: define “what to do” for each group of columns once, then reuse.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Prevents Data Leakage
&lt;/h2&gt;

&lt;p&gt;Data leakage happens when information from the test set influences training. Common mistake:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Wrong: scaling before split or on full X
&lt;/span&gt;&lt;span class="n"&gt;scaler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;StandardScaler&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;X_scaled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;scaler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Correct pattern with pipelines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pipeline&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;scaler&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;StandardScaler&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;clf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;LogisticRegression&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_train&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# scaler learns only from X_train
&lt;/span&gt;&lt;span class="n"&gt;y_pred&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_test&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# scaler uses training stats on X_test
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;During cross-validation, scikit-learn refits the entire pipeline on each training fold, so preprocessing never sees the validation fold.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tuning Hyperparameters Across Steps
&lt;/h2&gt;

&lt;p&gt;Pipelines let you tune parameters from any step using &lt;code&gt;stepname__param&lt;/code&gt; syntax.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.model_selection&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GridSearchCV&lt;/span&gt;

&lt;span class="n"&gt;param_grid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;scaler__with_mean&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;clf__C&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;grid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;GridSearchCV&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;param_grid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cv&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_train&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This searches over both scaling options and model regularization jointly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Custom Steps When You Need Them
&lt;/h2&gt;

&lt;p&gt;Sometimes you need your own transformation. You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wrap a simple function with &lt;code&gt;FunctionTransformer&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Or write a small class that follows scikit-learn’s transformer interface.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Simple function example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.preprocessing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FunctionTransformer&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;

&lt;span class="n"&gt;pipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pipeline&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;log&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;FunctionTransformer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;log1p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;validate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;clf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;LogisticRegression&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more complex logic, define a class with &lt;code&gt;fit&lt;/code&gt; and &lt;code&gt;transform&lt;/code&gt; methods and use it like any other step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Saving and Reusing Your Model
&lt;/h2&gt;

&lt;p&gt;Once your pipeline is trained, save the whole thing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;joblib&lt;/span&gt;

&lt;span class="n"&gt;joblib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_pipeline.joblib&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Later, in another script or service:
&lt;/span&gt;&lt;span class="n"&gt;loaded&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;joblib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;model_pipeline.joblib&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;y_pred&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;loaded&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_new&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You don’t need to re-implement preprocessing; it’s all inside the saved pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Minimal Complete Example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.datasets&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;fetch_openml&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.model_selection&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;train_test_split&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.compose&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ColumnTransformer&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.preprocessing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OneHotEncoder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;StandardScaler&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.impute&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SimpleImputer&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.pipeline&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Pipeline&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.ensemble&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RandomForestClassifier&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="c1"&gt;# Load a sample dataset
&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fetch_openml&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;adult&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;as_frame&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;X&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;gt;50K&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;astype&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;num_cols&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;select_dtypes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;int64&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;float64&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;
&lt;span class="n"&gt;cat_cols&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;select_dtypes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;object&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;

&lt;span class="n"&gt;num_pipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pipeline&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;imputer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;SimpleImputer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strategy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;median&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;scaler&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;StandardScaler&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;cat_pipe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pipeline&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;imputer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;SimpleImputer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strategy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;most_frequent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;onehot&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;OneHotEncoder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;handle_unknown&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ignore&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;preprocess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ColumnTransformer&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;num&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;num_pipe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;num_cols&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cat&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cat_pipe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cat_cols&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pipeline&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;preprocess&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;preprocess&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;clf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;RandomForestClassifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n_estimators&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;random_state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;X_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;X_test&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_test&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;train_test_split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;test_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;random_state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_train&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_train&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Test accuracy:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_test&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_test&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This single &lt;code&gt;model&lt;/code&gt; object handles imputation, encoding, scaling, and prediction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Checklist for Using Pipelines
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Put all preprocessing inside the pipeline, not outside.&lt;/li&gt;
&lt;li&gt;Fit only on &lt;code&gt;X_train&lt;/code&gt;, &lt;code&gt;y_train&lt;/code&gt;; use the pipeline to predict on new data.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;ColumnTransformer&lt;/code&gt; when you have mixed column types.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;make_pipeline&lt;/code&gt; for quick experiments; use &lt;code&gt;Pipeline&lt;/code&gt; when you want clear step names.&lt;/li&gt;
&lt;li&gt;Save the entire pipeline for deployment.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>machinelearning</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Why Hypothesis Testing is the Backbone of Data Science</title>
      <dc:creator>Jonathan kip</dc:creator>
      <pubDate>Fri, 07 Aug 2026 11:35:44 +0000</pubDate>
      <link>https://dev.to/jonathan_kip/why-hypothesis-testing-is-the-backbone-of-data-science-52io</link>
      <guid>https://dev.to/jonathan_kip/why-hypothesis-testing-is-the-backbone-of-data-science-52io</guid>
      <description>&lt;h2&gt;
  
  
  Why Hypothesis Testing is the Backbone of Data Science
&lt;/h2&gt;

&lt;p&gt;Hypothesis testing is the backbone of data science because it provides a rigorous, structured way to distinguish real patterns from random noise and to make decisions backed by statistical evidence rather than intuition.  It allows data scientists to validate assumptions, quantify uncertainty, and determine whether observed results are genuine or just due to chance—making it essential for trustworthy models, experiments, and business decisions. &lt;a href="https://openstax.org/books/principles-data-science/pages/4-2-hypothesis-testing" rel="noopener noreferrer"&gt;openstax&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Hypothesis Testing?
&lt;/h2&gt;

&lt;p&gt;Hypothesis testing is a statistical method used to evaluate claims about a population using sample data.  It works by setting up two mutually exclusive hypotheses: &lt;a href="https://openstax.org/books/principles-data-science/pages/4-2-hypothesis-testing" rel="noopener noreferrer"&gt;openstax&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Null hypothesis (H₀)&lt;/strong&gt;: The default assumption (e.g., “There is no difference between two groups”). &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alternative hypothesis (H₁)&lt;/strong&gt;: The claim you want to test (e.g., “There is a difference between two groups”). &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By analyzing sample data, you assess the likelihood of observing your results under the assumption that H₀ is true, and decide whether there’s enough evidence to reject it. &lt;a href="https://openstax.org/books/principles-data-science/pages/4-2-hypothesis-testing" rel="noopener noreferrer"&gt;openstax&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Hypothesis Testing Matters in Data Science
&lt;/h2&gt;

&lt;p&gt;Hypothesis testing is not just a math exercise—it’s the foundation of evidence-based decision-making in data science.  Here’s why it’s so critical: &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Separates Signal from Noise
&lt;/h3&gt;

&lt;p&gt;In the era of big data, patterns can appear by pure luck.  Hypothesis testing answers a key question: &lt;strong&gt;“Is this pattern real, or did it happen by chance?”&lt;/strong&gt;  This helps you avoid acting on false positives or misleading trends. &lt;/p&gt;

&lt;h3&gt;
  
  
  2. Validates Assumptions and Models
&lt;/h3&gt;

&lt;p&gt;Data science workflows rely on assumptions—about data distributions, feature importance, or model performance.  Hypothesis testing provides a structured way to: &lt;a href="https://openstax.org/books/principles-data-science/pages/4-2-hypothesis-testing" rel="noopener noreferrer"&gt;openstax&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Validate whether a new model or feature actually improves performance. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Confirm that observed differences (e.g., in conversion rates) are statistically significant. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Test assumptions required by statistical methods (e.g., normality, equal variances). &lt;a href="https://www.geeksforgeeks.org/data-science/why-hypothesis-testing-is-important-in-research-/" rel="noopener noreferrer"&gt;geeksforgeeks&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Enables Data-Driven Decision-Making
&lt;/h3&gt;

&lt;p&gt;Instead of relying on gut feelings or anecdotes, hypothesis testing transforms assumptions into evidence.  It allows you to: &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make quantifiable, data-backed decisions. &lt;a href="https://www.linkedin.com/pulse/hypothesis-testing-data-science-complete-guide-mohamed-chizari-azwee" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Support business choices (e.g., launch a feature, change pricing) with statistical rigor. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Build confidence among stakeholders by showing that results are validated, not guessed. &lt;a href="https://www.geeksforgeeks.org/data-science/why-hypothesis-testing-is-important-in-research-/" rel="noopener noreferrer"&gt;geeksforgeeks&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Forms the Foundation of Experimentation
&lt;/h3&gt;

&lt;p&gt;Hypothesis testing is the engine behind A/B testing, clinical trials, and scientific experiments.  It helps you: &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Design experiments in a methodical way. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Determine whether changes in one variable directly impact another (causality, not just correlation). &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Calculate sample sizes and interpret p-values to draw statistically valid inferences. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Quantifies Uncertainty and Risk
&lt;/h3&gt;

&lt;p&gt;Every data-driven decision carries risk.  Hypothesis testing quantifies that uncertainty by: &lt;a href="https://openstax.org/books/principles-data-science/pages/4-2-hypothesis-testing" rel="noopener noreferrer"&gt;openstax&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Providing p-values that measure the strength of evidence against the null hypothesis. &lt;a href="https://openstax.org/books/principles-data-science/pages/4-2-hypothesis-testing" rel="noopener noreferrer"&gt;openstax&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Controlling error rates (Type I and Type II) to balance false positives and false negatives. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Generating confidence intervals that show the range of plausible values for an effect. &lt;a href="https://www.geeksforgeeks.org/data-science/why-hypothesis-testing-is-important-in-research-/" rel="noopener noreferrer"&gt;geeksforgeeks&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Core Concepts in Hypothesis Testing
&lt;/h2&gt;

&lt;p&gt;To use hypothesis testing effectively, you need to understand these key concepts:&lt;/p&gt;

&lt;h3&gt;
  
  
  Null and Alternative Hypotheses
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Null hypothesis (H₀)&lt;/strong&gt;: Represents the status quo (e.g., “The new feature has no effect on conversion rate”). &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alternative hypothesis (H₁)&lt;/strong&gt;: Represents the effect you’re testing for (e.g., “The new feature increases conversion rate”). &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  P-Value and Significance Level
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;P-value&lt;/strong&gt;: The probability of observing your data (or more extreme) if H₀ is true. &lt;a href="https://openstax.org/books/principles-data-science/pages/4-2-hypothesis-testing" rel="noopener noreferrer"&gt;openstax&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Significance level (α)&lt;/strong&gt;: A threshold (commonly 0.05) below which you reject H₀. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;If &lt;strong&gt;p &amp;lt; α&lt;/strong&gt;, the result is considered statistically significant, and you reject H₀. &lt;a href="https://openstax.org/books/principles-data-science/pages/4-2-hypothesis-testing" rel="noopener noreferrer"&gt;openstax&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Type I and Type II Errors
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Type I error (false positive)&lt;/strong&gt;: Rejecting H₀ when it’s actually true. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type II error (false negative)&lt;/strong&gt;: Failing to reject H₀ when it’s actually false. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
Balancing these errors is crucial—especially in high-stakes domains like healthcare or finance. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Common Hypothesis Tests
&lt;/h3&gt;

&lt;p&gt;Data scientists frequently use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;t-tests&lt;/strong&gt;: Compare means between two groups (e.g., treatment vs control).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Z-tests&lt;/strong&gt;: Similar to t-tests but for large samples or known variance.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chi-square tests&lt;/strong&gt;: Test relationships between categorical variables.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ANOVA&lt;/strong&gt;: Compare means across three or more groups.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mann-Whitney U / Wilcoxon&lt;/strong&gt;: Non-parametric alternatives when assumptions are violated. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Real-World Applications in Data Science
&lt;/h2&gt;

&lt;p&gt;Hypothesis testing powers decisions across industries and use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A/B Testing&lt;/strong&gt;: Validate whether a new UI, pricing strategy, or marketing campaign actually improves metrics. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feature Selection&lt;/strong&gt;: Test whether a new feature significantly improves model performance. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Medical Studies&lt;/strong&gt;: Determine if a new treatment is more effective than a placebo. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manufacturing &amp;amp; Quality Control&lt;/strong&gt;: Verify whether a process change reduces defects.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customer Analytics&lt;/strong&gt;: Test if churn rates differ between user segments. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common Pitfalls and How to Avoid Them
&lt;/h2&gt;

&lt;p&gt;Even with its power, hypothesis testing can be misused. Watch out for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;P-hacking&lt;/strong&gt;: Running many tests until you find a “significant” result by chance.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignoring effect size&lt;/strong&gt;: A tiny effect can be statistically significant with a large sample but meaningless in practice. &lt;a href="https://www.geeksforgeeks.org/data-science/why-hypothesis-testing-is-important-in-research-/" rel="noopener noreferrer"&gt;geeksforgeeks&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Misinterpreting p-values&lt;/strong&gt;: A p-value is not the probability that H₀ is true—it’s the probability of your data under H₀. &lt;a href="https://www.geeksforgeeks.org/data-science/why-hypothesis-testing-is-important-in-research-/" rel="noopener noreferrer"&gt;geeksforgeeks&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Overlooking assumptions&lt;/strong&gt;: Many tests assume normality, equal variance, or independence—violating these can invalidate results. &lt;a href="https://openstax.org/books/principles-data-science/pages/4-2-hypothesis-testing" rel="noopener noreferrer"&gt;openstax&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bottom Line
&lt;/h2&gt;

&lt;p&gt;Hypothesis testing is the powerful backbone of modern data science because it turns observations into evidence and assumptions into validated insights.  It enables data scientists to: &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Distinguish real patterns from random noise.
&lt;/li&gt;
&lt;li&gt;Make decisions with quantified uncertainty. &lt;a href="https://openstax.org/books/principles-data-science/pages/4-2-hypothesis-testing" rel="noopener noreferrer"&gt;openstax&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Build trustworthy models and experiments. &lt;a href="https://www.dasca.org/world-of-data-science/article/hypothesis-testing-in-data-science-validating-decisions-with-data" rel="noopener noreferrer"&gt;dasca&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without hypothesis testing, data science would rely on guesswork and anecdote—undermining the credibility, reliability, and impact of every analysis.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>datascience</category>
      <category>machinelearning</category>
      <category>analytics</category>
    </item>
    <item>
      <title>Understanding Statistical Distributions and Their Impact on Data Science</title>
      <dc:creator>Jonathan kip</dc:creator>
      <pubDate>Fri, 07 Aug 2026 11:31:13 +0000</pubDate>
      <link>https://dev.to/jonathan_kip/understanding-statistical-distributions-and-their-impact-on-data-science-nh1</link>
      <guid>https://dev.to/jonathan_kip/understanding-statistical-distributions-and-their-impact-on-data-science-nh1</guid>
      <description>&lt;h2&gt;
  
  
  Understanding Statistical Distributions and Their Impact on Data Science
&lt;/h2&gt;

&lt;p&gt;Statistical distributions are the backbone of data science—they describe how data values are spread, how likely certain outcomes are, and how uncertain our measurements really are.  Misunderstanding or misapplying a distribution can lead to invalid tests, biased models, and poor business decisions, while using the right one improves accuracy, interpretability, and model robustness. &lt;a href="https://www.sciencedirect.com/topics/computer-science/statistical-distribution" rel="noopener noreferrer"&gt;sciencedirect&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is a Statistical Distribution?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;statistical distribution&lt;/strong&gt; is a mathematical function that assigns probabilities to possible outcomes of a random variable.  It describes how values are spread across a dataset—where most observations cluster, how much variation exists, and whether extreme values (outliers) are common or rare. &lt;a href="https://www.sciencedirect.com/topics/computer-science/statistical-distribution" rel="noopener noreferrer"&gt;sciencedirect&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Distributions answer key questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How likely is a particular event?
&lt;/li&gt;
&lt;li&gt;What values are typical or extreme?
&lt;/li&gt;
&lt;li&gt;How uncertain is our data? &lt;a href="https://www.sciencedirect.com/topics/computer-science/statistical-distribution" rel="noopener noreferrer"&gt;sciencedirect&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Types of Distributions
&lt;/h2&gt;

&lt;p&gt;Distributions are broadly categorized by the type of data they model. &lt;a href="https://www.sciencedirect.com/topics/computer-science/statistical-distribution" rel="noopener noreferrer"&gt;sciencedirect&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Discrete vs Continuous
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Discrete distributions&lt;/strong&gt;: Model countable outcomes (e.g., number of purchases, clicks, defects). Examples: Binomial, Poisson, Bernoulli. &lt;a href="https://www.sciencedirect.com/topics/computer-science/statistical-distribution" rel="noopener noreferrer"&gt;sciencedirect&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Continuous distributions&lt;/strong&gt;: Model measurable quantities (e.g., height, temperature, time). Examples: Normal, Uniform, Exponential, Log-Normal. &lt;a href="https://www.sciencedirect.com/topics/computer-science/statistical-distribution" rel="noopener noreferrer"&gt;sciencedirect&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Distributions in Data Science
&lt;/h3&gt;

&lt;p&gt;Here are some of the most important distributions and their typical use cases:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Distribution&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Key Parameters&lt;/th&gt;
&lt;th&gt;Typical Use Cases&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Normal (Gaussian)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Continuous&lt;/td&gt;
&lt;td&gt;Mean (μ), Standard Deviation (σ)&lt;/td&gt;
&lt;td&gt;Residuals in regression, many natural phenomena, Z-tests, confidence intervals  &lt;a href="https://www.sciencedirect.com/topics/computer-science/statistical-distribution" rel="noopener noreferrer"&gt;sciencedirect&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Uniform&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Continuous or Discrete&lt;/td&gt;
&lt;td&gt;Min, Max&lt;/td&gt;
&lt;td&gt;Random sampling, baseline models, Monte Carlo simulations  &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Binomial&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Discrete&lt;/td&gt;
&lt;td&gt;Trials (n), Success probability (p)&lt;/td&gt;
&lt;td&gt;Binary outcomes (e.g., click/no-click, defect/no defect)  &lt;a href="https://www3.cs.stonybrook.edu/~skiena/data-manual/lectures/pdf/L9.pdf" rel="noopener noreferrer"&gt;www3.cs.stonybrook&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Poisson&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Discrete&lt;/td&gt;
&lt;td&gt;Rate (λ)&lt;/td&gt;
&lt;td&gt;Count of events in fixed time (e.g., calls per hour, arrivals)  &lt;a href="https://www3.cs.stonybrook.edu/~skiena/data-manual/lectures/pdf/L9.pdf" rel="noopener noreferrer"&gt;www3.cs.stonybrook&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Exponential&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Continuous&lt;/td&gt;
&lt;td&gt;Rate (λ)&lt;/td&gt;
&lt;td&gt;Time between events (e.g., time between customer arrivals)  &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Log-Normal&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Continuous&lt;/td&gt;
&lt;td&gt;Mean, Std Dev (in log scale)&lt;/td&gt;
&lt;td&gt;Right-skewed data (e.g., income, time-to-failure)  &lt;a href="https://arounddatascience.com/blog/mathematics-and-statistics/the-complete-guide-to-statistical-distributions-for-data-science/" rel="noopener noreferrer"&gt;arounddatascience&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Student’s t&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Continuous&lt;/td&gt;
&lt;td&gt;Degrees of freedom&lt;/td&gt;
&lt;td&gt;Small-sample inference, hypothesis testing when variance is unknown  &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Why Distributions Matter in Data Science
&lt;/h2&gt;

&lt;p&gt;Understanding the underlying distribution of your data is critical because it affects nearly every stage of analysis and modeling. &lt;a href="https://github.com/stephenomengo/Understanding-Data-Distributions-and-Their-Impact-on-Data-Science" rel="noopener noreferrer"&gt;github&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Guides Exploratory Data Analysis (EDA)
&lt;/h3&gt;

&lt;p&gt;Distributions help you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spot patterns that simple summary statistics (mean, median) might hide. &lt;a href="https://dev.to/tom_chege/understanding-data-distributions-and-their-importance-in-data-science-j1a"&gt;dev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Detect outliers, data entry errors, and unexpected observations. &lt;a href="https://github.com/stephenomengo/Understanding-Data-Distributions-and-Their-Impact-on-Data-Science" rel="noopener noreferrer"&gt;github&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Choose the right summary measures (mean vs median, standard deviation vs IQR). &lt;a href="https://www.linkedin.com/posts/sivaganesh-m-38806a2b1_datascience-statistics-machinelearning-activity-7445868026593460224-6HSf" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Determines Statistical Assumptions
&lt;/h3&gt;

&lt;p&gt;Many statistical tests and models assume specific distributions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Normal distribution&lt;/strong&gt;: Assumed by linear regression residuals, t-tests, ANOVA, and many parametric methods. &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Poisson distribution&lt;/strong&gt;: Used for count-based models and event-rate analysis. &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Binomial distribution&lt;/strong&gt;: Underpins binary classification and A/B testing. &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If these assumptions are violated, results can be misleading or invalid. &lt;a href="https://arounddatascience.com/blog/mathematics-and-statistics/the-complete-guide-to-statistical-distributions-for-data-science/" rel="noopener noreferrer"&gt;arounddatascience&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Influences Model Performance
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Choosing the wrong distribution can lead to biased estimators, poor model fit, and inaccurate predictions. &lt;a href="https://arounddatascience.com/blog/mathematics-and-statistics/the-complete-guide-to-statistical-distributions-for-data-science/" rel="noopener noreferrer"&gt;arounddatascience&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Correct distribution choice improves model accuracy, interpretability, and robustness. &lt;a href="https://arounddatascience.com/blog/mathematics-and-statistics/the-complete-guide-to-statistical-distributions-for-data-science/" rel="noopener noreferrer"&gt;arounddatascience&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, applying linear regression to heavily right-skewed data without transformation often produces biased estimates and unreliable confidence intervals. &lt;a href="https://arounddatascience.com/blog/mathematics-and-statistics/the-complete-guide-to-statistical-distributions-for-data-science/" rel="noopener noreferrer"&gt;arounddatascience&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Shapes Feature Engineering and Preprocessing
&lt;/h3&gt;

&lt;p&gt;Understanding distribution helps you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Decide whether to apply &lt;strong&gt;log, square root, or Box-Cox transformations&lt;/strong&gt; to normalize skewed data. &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Choose between &lt;strong&gt;standardization&lt;/strong&gt; (mean=0, std=1) and &lt;strong&gt;normalization&lt;/strong&gt; (min–max scaling). &lt;a href="https://www.linkedin.com/posts/sivaganesh-m-38806a2b1_datascience-statistics-machinelearning-activity-7445868026593460224-6HSf" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Handle outliers appropriately (cap, remove, or model with heavy-tailed distributions). &lt;a href="https://www.linkedin.com/posts/sivaganesh-m-38806a2b1_datascience-statistics-machinelearning-activity-7445868026593460224-6HSf" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to Analyze Distributions in Practice
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Visualize the Data
&lt;/h3&gt;

&lt;p&gt;Start with simple plots to understand the shape of your data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Histograms&lt;/strong&gt;: Show the frequency of values across bins. &lt;a href="https://www.youtube.com/watch?v=pLQ9RPj6TYE" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Box plots&lt;/strong&gt;: Highlight median, quartiles, and outliers. &lt;a href="https://www.youtube.com/watch?v=pLQ9RPj6TYE" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Q-Q plots&lt;/strong&gt;: Compare your data to a theoretical distribution (e.g., Normal). &lt;a href="https://www.youtube.com/watch?v=pLQ9RPj6TYE" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Compute Descriptive Statistics
&lt;/h3&gt;

&lt;p&gt;Key metrics that describe distribution shape:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Central tendency&lt;/strong&gt;: Mean, median, mode. &lt;a href="https://www.linkedin.com/posts/sivaganesh-m-38806a2b1_datascience-statistics-machinelearning-activity-7445868026593460224-6HSf" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dispersion&lt;/strong&gt;: Variance, standard deviation, interquartile range (IQR). &lt;a href="https://www.linkedin.com/posts/sivaganesh-m-38806a2b1_datascience-statistics-machinelearning-activity-7445868026593460224-6HSf" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shape&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Skewness&lt;/strong&gt;: Measures asymmetry (positive = right tail, negative = left tail). &lt;a href="https://www.linkedin.com/posts/sivaganesh-m-38806a2b1_datascience-statistics-machinelearning-activity-7445868026593460224-6HSf" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kurtosis&lt;/strong&gt;: Measures tail heaviness (high = more outliers, low = flatter distribution). &lt;a href="https://www.linkedin.com/posts/sivaganesh-m-38806a2b1_datascience-statistics-machinelearning-activity-7445868026593460224-6HSf" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Test for Distribution Fit
&lt;/h3&gt;

&lt;p&gt;Use statistical tests to check if your data matches a theoretical distribution:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shapiro-Wilk&lt;/strong&gt;: Tests for normality. &lt;a href="https://www.youtube.com/watch?v=pLQ9RPj6TYE" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kolmogorov-Smirnov&lt;/strong&gt;: Compares data to a reference distribution. &lt;a href="https://www.youtube.com/watch?v=pLQ9RPj6TYE" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anderson-Darling&lt;/strong&gt;: Another normality test, sensitive to tails. &lt;a href="https://www.youtube.com/watch?v=pLQ9RPj6TYE" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These tests help you decide whether parametric methods (e.g., t-tests) are appropriate or if non-parametric alternatives are needed. &lt;a href="https://www.youtube.com/watch?v=pLQ9RPj6TYE" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Implications for Data Science Workflows
&lt;/h2&gt;

&lt;h3&gt;
  
  
  A/B Testing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Conversion rates typically follow a &lt;strong&gt;Binomial distribution&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Sample size calculations and p-values depend on correct distribution assumptions. &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Regression Models
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Linear regression assumes &lt;strong&gt;normally distributed residuals&lt;/strong&gt; with mean zero.
&lt;/li&gt;
&lt;li&gt;Violations lead to biased coefficients and unreliable confidence intervals. &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Anomaly Detection
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Heavy-tailed or skewed distributions suggest more frequent outliers.
&lt;/li&gt;
&lt;li&gt;Understanding kurtosis helps you choose robust detection methods (e.g., IQR, isolation forests). &lt;a href="https://www.linkedin.com/posts/sivaganesh-m-38806a2b1_datascience-statistics-machinelearning-activity-7445868026593460224-6HSf" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Time-to-Event Modeling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Exponential&lt;/strong&gt; and &lt;strong&gt;Poisson&lt;/strong&gt; distributions model event rates and inter-arrival times.
&lt;/li&gt;
&lt;li&gt;Useful in churn prediction, customer arrivals, or failure analysis. &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Monte Carlo Simulations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Simulations often start by generating random variables from a &lt;strong&gt;Uniform&lt;/strong&gt; or &lt;strong&gt;Normal&lt;/strong&gt; distribution.
&lt;/li&gt;
&lt;li&gt;Accurate simulations depend on realistic distribution choices. &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common Mistakes and How to Avoid Them
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Assuming normality blindly&lt;/strong&gt;: Always check distribution shape with plots and tests before applying parametric methods. &lt;a href="https://www3.cs.stonybrook.edu/~skiena/data-manual/lectures/pdf/L9.pdf" rel="noopener noreferrer"&gt;www3.cs.stonybrook&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignoring skewness and outliers&lt;/strong&gt;: Skewed data can bias mean and standard deviation; use median and IQR for robust summaries. &lt;a href="https://www.linkedin.com/posts/sivaganesh-m-38806a2b1_datascience-statistics-machinelearning-activity-7445868026593460224-6HSf" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Using the wrong distribution for counts or rates&lt;/strong&gt;: Apply Poisson or Binomial models instead of continuous ones for discrete events. &lt;a href="https://towardsdatascience.com/seven-must-know-statistical-distributions-and-their-simulations-for-data-science-681c5ac41e32/" rel="noopener noreferrer"&gt;towardsdatascience&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Overlooking heavy tails&lt;/strong&gt;: High kurtosis means more extreme values—use robust models or transformations. &lt;a href="https://www.linkedin.com/posts/sivaganesh-m-38806a2b1_datascience-statistics-machinelearning-activity-7445868026593460224-6HSf" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bottom Line
&lt;/h2&gt;

&lt;p&gt;Statistical distributions are not just theoretical—they’re the foundation of every model, test, and insight in data science.  They guide how you explore data, which methods you use, how you preprocess features, and how you interpret results. &lt;a href="https://arounddatascience.com/blog/mathematics-and-statistics/the-complete-guide-to-statistical-distributions-for-data-science/" rel="noopener noreferrer"&gt;arounddatascience&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before building any model or running any test, always ask: &lt;strong&gt;“What is my data really telling me about its distribution?”&lt;/strong&gt; &lt;a href="https://www.linkedin.com/posts/sivaganesh-m-38806a2b1_datascience-statistics-machinelearning-activity-7445868026593460224-6HSf" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>analytics</category>
      <category>machinelearning</category>
      <category>python</category>
    </item>
    <item>
      <title>Python for Data Analytics: A Beginner’s Complete Guide</title>
      <dc:creator>Jonathan kip</dc:creator>
      <pubDate>Fri, 07 Aug 2026 11:28:07 +0000</pubDate>
      <link>https://dev.to/jonathan_kip/python-for-data-analytics-a-beginners-complete-guide-jod</link>
      <guid>https://dev.to/jonathan_kip/python-for-data-analytics-a-beginners-complete-guide-jod</guid>
      <description>&lt;h2&gt;
  
  
  Python for Data Analytics: A Beginner’s Complete Guide
&lt;/h2&gt;

&lt;p&gt;Python has become the go-to language for data analytics because it’s easy to learn, has powerful libraries, and works well with data of all sizes.  This guide walks you through everything you need to know to get started—from setting up your environment to building your first data analysis project. &lt;a href="https://realpython.com/python-for-data-analysis/" rel="noopener noreferrer"&gt;realpython&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Python for Data Analytics?
&lt;/h2&gt;

&lt;p&gt;Python is popular for data analytics because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Simple syntax&lt;/strong&gt;: It’s beginner-friendly and reads like plain English. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rich ecosystem&lt;/strong&gt;: Libraries like pandas, NumPy, and Matplotlib handle everything from data cleaning to visualization. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community and resources&lt;/strong&gt;: Millions of tutorials, courses, and free projects make it easy to learn and troubleshoot. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration&lt;/strong&gt;: Works well with databases, Excel, APIs, and big data tools.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Set Up Your Python Environment
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Option A: Anaconda (Recommended for Beginners)
&lt;/h3&gt;

&lt;p&gt;Anaconda bundles Python, Jupyter, and data science libraries in one installer. &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Download Anaconda&lt;/strong&gt; from &lt;a href="https://anaconda.com/download" rel="noopener noreferrer"&gt;anaconda.com/download&lt;/a&gt;. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run the installer&lt;/strong&gt; and follow the default steps. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open Anaconda Navigator&lt;/strong&gt; and launch &lt;strong&gt;Jupyter Notebook&lt;/strong&gt;. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Option B: Python + VS Code + Jupyter
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Install Python&lt;/strong&gt; from &lt;a href="https://www.python.org/downloads" rel="noopener noreferrer"&gt;python.org/downloads&lt;/a&gt;. &lt;a href="https://www.youtube.com/watch?v=r-uOLxNrNk8" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install VS Code&lt;/strong&gt; from &lt;a href="https://code.visualstudio.com" rel="noopener noreferrer"&gt;code.visualstudio.com&lt;/a&gt;. &lt;a href="https://www.youtube.com/watch?v=r-uOLxNrNk8" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add the Python and Jupyter extensions&lt;/strong&gt; in VS Code. &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create a virtual environment&lt;/strong&gt; to keep your packages organized. &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Install Essential Libraries
&lt;/h3&gt;

&lt;p&gt;If you’re not using Anaconda, install key packages with pip: &lt;a href="https://realpython.com/python-for-data-analysis/" rel="noopener noreferrer"&gt;realpython&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;pandas numpy matplotlib seaborn jupyter
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Learn Python Basics
&lt;/h2&gt;

&lt;p&gt;Before diving into data analysis, get comfortable with Python fundamentals. &lt;a href="https://www.w3resource.com/python/python-for-data-analysis-the-complete-guide.php" rel="noopener noreferrer"&gt;w3resource&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Variables and data types&lt;/strong&gt;: Numbers, strings, booleans. &lt;a href="https://www.w3resource.com/python/python-for-data-analysis-the-complete-guide.php" rel="noopener noreferrer"&gt;w3resource&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data structures&lt;/strong&gt;: Lists, dictionaries, tuples, sets. &lt;a href="https://www.w3resource.com/python/python-for-data-analysis-the-complete-guide.php" rel="noopener noreferrer"&gt;w3resource&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Control flow&lt;/strong&gt;: &lt;code&gt;if&lt;/code&gt; statements, &lt;code&gt;for&lt;/code&gt; and &lt;code&gt;while&lt;/code&gt; loops. &lt;a href="https://www.youtube.com/watch?v=SSeFPWNl-Hw" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Functions&lt;/strong&gt;: Reusable blocks of code with &lt;code&gt;def&lt;/code&gt;. &lt;a href="https://www.w3resource.com/python/python-for-data-analysis-the-complete-guide.php" rel="noopener noreferrer"&gt;w3resource&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;List comprehensions&lt;/strong&gt;: Compact way to create lists. &lt;a href="https://www.youtube.com/watch?v=SSeFPWNl-Hw" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Practice by writing small scripts—like a grade calculator or a text analyzer. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Core Libraries for Data Analytics
&lt;/h2&gt;

&lt;h3&gt;
  
  
  NumPy: Numerical Computing
&lt;/h3&gt;

&lt;p&gt;NumPy is the foundation for numerical operations in Python. &lt;a href="https://realpython.com/python-for-data-analysis/" rel="noopener noreferrer"&gt;realpython&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creates and manipulates arrays (vectors and matrices).
&lt;/li&gt;
&lt;li&gt;Performs fast mathematical operations.
&lt;/li&gt;
&lt;li&gt;Used by pandas and other libraries under the hood.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;

&lt;span class="n"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;  &lt;span class="c1"&gt;# 2.5
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  pandas: Data Manipulation
&lt;/h3&gt;

&lt;p&gt;pandas is the most important library for data analysis. &lt;a href="https://realpython.com/python-for-data-analysis/" rel="noopener noreferrer"&gt;realpython&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Loads data from CSV, Excel, SQL, and more.
&lt;/li&gt;
&lt;li&gt;Cleans, filters, and transforms data using DataFrames.
&lt;/li&gt;
&lt;li&gt;Summarizes and aggregates data with groupby operations.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sales.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;head&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;          &lt;span class="c1"&gt;# First 5 rows
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;      &lt;span class="c1"&gt;# Summary statistics
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isnull&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;  &lt;span class="c1"&gt;# Missing values per column
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key pandas skills:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data loading&lt;/strong&gt;: &lt;code&gt;read_csv()&lt;/code&gt;, &lt;code&gt;read_excel()&lt;/code&gt;, &lt;code&gt;read_sql()&lt;/code&gt;. &lt;a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC7983091/" rel="noopener noreferrer"&gt;pmc.ncbi.nlm.nih&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inspection&lt;/strong&gt;: &lt;code&gt;head()&lt;/code&gt;, &lt;code&gt;info()&lt;/code&gt;, &lt;code&gt;describe()&lt;/code&gt;. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cleaning&lt;/strong&gt;: &lt;code&gt;dropna()&lt;/code&gt;, &lt;code&gt;fillna()&lt;/code&gt;, &lt;code&gt;drop_duplicates()&lt;/code&gt;. &lt;a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC7983091/" rel="noopener noreferrer"&gt;pmc.ncbi.nlm.nih&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filtering&lt;/strong&gt;: Boolean masks, &lt;code&gt;loc&lt;/code&gt;, &lt;code&gt;iloc&lt;/code&gt;. &lt;a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC7983091/" rel="noopener noreferrer"&gt;pmc.ncbi.nlm.nih&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Aggregation&lt;/strong&gt;: &lt;code&gt;groupby()&lt;/code&gt;, &lt;code&gt;pivot_table()&lt;/code&gt;. &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Matplotlib &amp;amp; Seaborn: Data Visualization
&lt;/h3&gt;

&lt;p&gt;Matplotlib and Seaborn help you create charts and graphs. &lt;a href="https://realpython.com/python-for-data-analysis/" rel="noopener noreferrer"&gt;realpython&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Matplotlib&lt;/strong&gt;: Basic plotting (line, bar, scatter, histograms).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Seaborn&lt;/strong&gt;: Beautiful statistical plots with less code.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;seaborn&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;sns&lt;/span&gt;

&lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;histplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;salary&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;bins&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Common chart types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Histograms&lt;/strong&gt;: Distribution of a single variable.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bar charts&lt;/strong&gt;: Compare categories.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scatter plots&lt;/strong&gt;: Relationship between two variables.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Box plots&lt;/strong&gt;: Show median, quartiles, and outliers. &lt;a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC7983091/" rel="noopener noreferrer"&gt;pmc.ncbi.nlm.nih&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 4: The Data Analysis Workflow
&lt;/h2&gt;

&lt;p&gt;A typical data analysis project in Python follows these steps: &lt;a href="https://realpython.com/python-for-data-analysis/" rel="noopener noreferrer"&gt;realpython&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Define Your Objective
&lt;/h3&gt;

&lt;p&gt;Ask a clear question: “What are the top-selling products?” or “Which factors affect customer churn?” &lt;a href="https://realpython.com/python-for-data-analysis/" rel="noopener noreferrer"&gt;realpython&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Load and Inspect the Data
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;data.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;head&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check for missing values, data types, and overall structure. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Clean the Data
&lt;/h3&gt;

&lt;p&gt;Data cleaning often takes the most time. &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Handle missing values&lt;/strong&gt;: Remove or fill with mean/median.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Remove duplicates&lt;/strong&gt;: &lt;code&gt;df.drop_duplicates()&lt;/code&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fix data types&lt;/strong&gt;: Convert strings to dates, numbers to categories.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat outliers&lt;/strong&gt;: Filter or cap extreme values. &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Explore and Analyze (EDA)
&lt;/h3&gt;

&lt;p&gt;Use summary statistics and visualizations to understand patterns. &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Univariate analysis&lt;/strong&gt;: Distribution of one variable.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bivariate analysis&lt;/strong&gt;: Relationships between two variables.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Correlation analysis&lt;/strong&gt;: Which variables move together?
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GroupBy operations&lt;/strong&gt;: Compare metrics by category. &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Visualize Insights
&lt;/h3&gt;

&lt;p&gt;Create charts that tell a clear story. &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Seaborn for clean, publication-ready plots.
&lt;/li&gt;
&lt;li&gt;Label axes, add titles, and keep charts simple.
&lt;/li&gt;
&lt;li&gt;Highlight key findings (e.g., top categories, trends over time).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. Draw Conclusions and Communicate
&lt;/h3&gt;

&lt;p&gt;Summarize your findings in a Jupyter notebook or report. &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What did you discover?
&lt;/li&gt;
&lt;li&gt;What business decisions could be made?
&lt;/li&gt;
&lt;li&gt;What are the limitations or next steps?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 5: Build a Beginner Project
&lt;/h2&gt;

&lt;p&gt;Here’s a simple end-to-end project to add to your portfolio: &lt;a href="https://www.youtube.com/watch?v=SSeFPWNl-Hw" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Find a dataset&lt;/strong&gt; on Kaggle (e.g., sales, salaries, or customer reviews). &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load and explore&lt;/strong&gt; the data with &lt;code&gt;head()&lt;/code&gt;, &lt;code&gt;describe()&lt;/code&gt;, and &lt;code&gt;isnull()&lt;/code&gt;. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clean the data&lt;/strong&gt;: Remove or fill missing values, fix data types, drop duplicates. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analyze&lt;/strong&gt;: Calculate averages, medians, and distributions. Identify outliers. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visualize&lt;/strong&gt;: Create at least 3 charts that tell a clear story. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Conclude&lt;/strong&gt;: Write a short summary of your findings and potential business actions. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 6: Learning Roadmap (2026)
&lt;/h2&gt;

&lt;p&gt;If you’re planning your learning path, here’s a suggested timeline: &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Month 1–2&lt;/strong&gt;: Python basics + NumPy + pandas fundamentals
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Month 3&lt;/strong&gt;: Data cleaning, EDA, and visualization (Matplotlib/Seaborn/Plotly)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Month 4&lt;/strong&gt;: Advanced pandas (merge, pivot, groupby) + performance tools like Polars/DuckDB
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Month 5&lt;/strong&gt;: Statistics, hypothesis testing, and basic Scikit-learn
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Month 6+&lt;/strong&gt;: Build end-to-end projects, integrate SQL, and create a portfolio &lt;a href="https://www.ibm.com/think/topics/machine-learning-use-cases" rel="noopener noreferrer"&gt;ibm&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With 1–2 hours of daily practice, you can reach a functional level in 3–4 months and be job-ready in 6–12 months. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Follow free courses on YouTube (e.g., freeCodeCamp, Simplilearn, Luke Barousse). &lt;a href="https://www.w3resource.com/python/python-for-data-analysis-the-complete-guide.php" rel="noopener noreferrer"&gt;w3resource&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Practice on real datasets from Kaggle or Google Dataset Search. &lt;a href="https://www.tableau.com/learn/articles/machine-learning-examples" rel="noopener noreferrer"&gt;tableau&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Share your projects on GitHub and LinkedIn to build a portfolio. &lt;a href="https://www.youtube.com/watch?v=SSeFPWNl-Hw" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>datascience</category>
      <category>beginners</category>
      <category>python</category>
      <category>ai</category>
    </item>
    <item>
      <title>SQL Subqueries vs CTEs: Types, Differences, Performance, and When to Use Each</title>
      <dc:creator>Jonathan kip</dc:creator>
      <pubDate>Fri, 07 Aug 2026 11:18:21 +0000</pubDate>
      <link>https://dev.to/jonathan_kip/sql-subqueries-vs-ctes-types-differences-performance-and-when-to-use-each-ock</link>
      <guid>https://dev.to/jonathan_kip/sql-subqueries-vs-ctes-types-differences-performance-and-when-to-use-each-ock</guid>
      <description>&lt;h2&gt;
  
  
  SQL Subqueries vs CTEs: Types, Differences, Performance, and When to Use Each
&lt;/h2&gt;

&lt;p&gt;Subqueries and Common Table Expressions (CTEs) are two of the most common ways to break complex SQL logic into smaller, reusable pieces.  While they often produce the same results, they differ in readability, reusability, and—in some cases—performance. &lt;a href="https://learnsql.com/blog/cte-vs-subquery/" rel="noopener noreferrer"&gt;learnsql&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Subqueries?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;subquery&lt;/strong&gt; is a query nested inside another query.  It can appear in the &lt;code&gt;SELECT&lt;/code&gt;, &lt;code&gt;FROM&lt;/code&gt;, &lt;code&gt;WHERE&lt;/code&gt;, or &lt;code&gt;HAVING&lt;/code&gt; clauses. &lt;a href="https://learnsql.com/blog/cte-vs-subquery/" rel="noopener noreferrer"&gt;learnsql&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Subqueries
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Non-correlated subqueries&lt;/strong&gt;: Run independently once, then return results to the outer query. &lt;a href="https://dev.to/k1gen_/subqueries-vs-ctes-in-sql-a-complete-guide-for-beginners-49mf"&gt;dev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Correlated subqueries&lt;/strong&gt;: Reference columns from the outer query and run once per row—often slower on large datasets. &lt;a href="https://dev.to/k1gen_/subqueries-vs-ctes-in-sql-a-complete-guide-for-beginners-49mf"&gt;dev&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Non-correlated: find employees earning more than average salary&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;-- Correlated: find employees earning more than their department average&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;department&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;department&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;department&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What Are CTEs?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Common Table Expression (CTE)&lt;/strong&gt; is a named temporary result set defined using the &lt;code&gt;WITH&lt;/code&gt; clause.  It exists only for the duration of the query and can be referenced multiple times. &lt;a href="https://learnsql.com/blog/cte-vs-subquery/" rel="noopener noreferrer"&gt;learnsql&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;avg_salary&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;avg_sal&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;avg_salary&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;avg_sal&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Key Differences Between Subqueries and CTEs
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Subqueries&lt;/th&gt;
&lt;th&gt;CTEs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Definition location&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Inline, inside the main query&lt;/td&gt;
&lt;td&gt;Defined at the top with &lt;code&gt;WITH&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Naming&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Not required (except in PostgreSQL)&lt;/td&gt;
&lt;td&gt;Must be named&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Reusability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Can be used only once per occurrence&lt;/td&gt;
&lt;td&gt;Can be referenced multiple times in the same query&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Readability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Can become hard to read when deeply nested&lt;/td&gt;
&lt;td&gt;Breaks logic into named, readable steps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Use in &lt;code&gt;WHERE&lt;/code&gt; with &lt;code&gt;IN&lt;/code&gt;/&lt;code&gt;EXISTS&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No (CTEs must be joined or referenced differently)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Recursive queries&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Not supported&lt;/td&gt;
&lt;td&gt;Supported via recursive CTEs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance (modern DBs)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Often identical to CTEs&lt;/td&gt;
&lt;td&gt;Often identical to subqueries; older PostgreSQL materialized CTEs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Performance: Subqueries vs CTEs
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Short Answer
&lt;/h3&gt;

&lt;p&gt;In modern databases (PostgreSQL 12+, MySQL 8+, SQL Server 2019+, Snowflake, BigQuery), &lt;strong&gt;there is typically no performance difference&lt;/strong&gt; between equivalent subqueries and CTEs.  The query optimizer treats them similarly and often generates identical execution plans. &lt;a href="https://dev.to/k1gen_/subqueries-vs-ctes-in-sql-a-complete-guide-for-beginners-49mf"&gt;dev&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  When Performance Can Differ
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Older PostgreSQL versions (&amp;lt;12)&lt;/strong&gt;: CTEs were always materialized (computed once and stored), which could make them slower than inlined subqueries. &lt;a href="https://dev.to/k1gen_/subqueries-vs-ctes-in-sql-a-complete-guide-for-beginners-49mf"&gt;dev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeated logic&lt;/strong&gt;: If the same subquery appears multiple times, the database may recompute it each time, whereas a CTE is computed once and reused. &lt;a href="https://dev.to/wambuijoan/ctes-subqueries-and-query-optimisation-in-sql-3fin"&gt;dev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Correlated subqueries&lt;/strong&gt;: These can be slow on large tables because they run once per row, but modern optimizers sometimes rewrite them as joins. &lt;a href="https://dev.to/k1gen_/subqueries-vs-ctes-in-sql-a-complete-guide-for-beginners-49mf"&gt;dev&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What Actually Affects Performance
&lt;/h3&gt;

&lt;p&gt;Performance depends more on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Indexing and join conditions
&lt;/li&gt;
&lt;li&gt;Data size and distribution
&lt;/li&gt;
&lt;li&gt;Execution plan chosen by the optimizer
&lt;/li&gt;
&lt;li&gt;Partitioning and statistics
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;—not just whether you use a subquery or CTE. &lt;a href="https://www.linkedin.com/posts/sreerag-cr_dataengineering-sql-cte-activity-7429365220063592449-Z-ry" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Use Subqueries
&lt;/h2&gt;

&lt;p&gt;Use a &lt;strong&gt;subquery&lt;/strong&gt; when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need a single value or quick filter (e.g., &lt;code&gt;WHERE salary &amp;gt; (SELECT AVG(salary) ...)&lt;/code&gt;). &lt;a href="https://learnsql.com/blog/cte-vs-subquery/" rel="noopener noreferrer"&gt;learnsql&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The logic is short, simple, and used only once. &lt;a href="https://datawithsarah.com/post/sql-subqueries-vs-ctes-explained/" rel="noopener noreferrer"&gt;datawithsarah&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;You’re using &lt;code&gt;IN&lt;/code&gt; or &lt;code&gt;EXISTS&lt;/code&gt; in a &lt;code&gt;WHERE&lt;/code&gt; clause. &lt;a href="https://learnsql.com/blog/cte-vs-subquery/" rel="noopener noreferrer"&gt;learnsql&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;You’re writing a quick ad-hoc query where readability isn’t critical. &lt;a href="https://dev.to/ericmwaimiri/a-practical-guide-to-subqueries-and-ctes-in-sql-3574"&gt;dev&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When to Use CTEs
&lt;/h2&gt;

&lt;p&gt;Use a &lt;strong&gt;CTE&lt;/strong&gt; when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your query is long or has multiple logical steps. &lt;a href="https://learnsql.com/blog/cte-vs-subquery/" rel="noopener noreferrer"&gt;learnsql&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;You need to reference the same intermediate result multiple times. &lt;a href="https://learnsql.com/blog/cte-vs-subquery/" rel="noopener noreferrer"&gt;learnsql&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;You want to improve readability by naming each step. &lt;a href="https://datawithsarah.com/post/sql-subqueries-vs-ctes-explained/" rel="noopener noreferrer"&gt;datawithsarah&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;You’re writing recursive queries (e.g., hierarchical data like org charts). &lt;a href="https://learnsql.com/blog/cte-vs-subquery/" rel="noopener noreferrer"&gt;learnsql&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;You’re building production-level queries or ETL pipelines where maintainability matters. &lt;a href="https://datawithsarah.com/post/sql-subqueries-vs-ctes-explained/" rel="noopener noreferrer"&gt;datawithsarah&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Practical Example: Subquery vs CTE
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Subquery version:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;department&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;department&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;departments&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="k"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'New York'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CTE version (more readable):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;avg_salary&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;avg_sal&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="n"&gt;ny_departments&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;department&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;departments&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="k"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'New York'&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;employees&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;ny_departments&lt;/span&gt; &lt;span class="n"&gt;nd&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;department&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;department&lt;/span&gt;
&lt;span class="k"&gt;CROSS&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;avg_salary&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;avg_sal&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Bottom Line
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Subqueries&lt;/strong&gt; are great for simple, one-off logic and inline filters. &lt;a href="https://datawithsarah.com/post/sql-subqueries-vs-ctes-explained/" rel="noopener noreferrer"&gt;datawithsarah&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CTEs&lt;/strong&gt; shine when queries get complex, need multiple steps, or require reuse. &lt;a href="https://learnsql.com/blog/cte-vs-subquery/" rel="noopener noreferrer"&gt;learnsql&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt; is usually similar in modern databases—focus on readability and maintainability. &lt;a href="https://dev.to/k1gen_/subqueries-vs-ctes-in-sql-a-complete-guide-for-beginners-49mf"&gt;dev&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Choose the tool that makes your SQL clearer and easier to maintain, and always check the execution plan if performance is a concern. &lt;/p&gt;

</description>
      <category>sql</category>
      <category>datascience</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to Publish a Power BI Report and Embed it into a Website</title>
      <dc:creator>Jonathan kip</dc:creator>
      <pubDate>Fri, 07 Aug 2026 11:10:32 +0000</pubDate>
      <link>https://dev.to/jonathan_kip/how-to-publish-a-power-bi-report-and-embed-it-into-a-website-51o1</link>
      <guid>https://dev.to/jonathan_kip/how-to-publish-a-power-bi-report-and-embed-it-into-a-website-51o1</guid>
      <description>&lt;h2&gt;
  
  
  How to Publish a Power BI Report and Embed It into a Website
&lt;/h2&gt;

&lt;p&gt;Publishing a Power BI report and embedding it on a website is a straightforward process that lets you share interactive dashboards with anyone online.  Below is a step-by-step guide covering both public and secure embedding options. &lt;a href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-embed-secure" rel="noopener noreferrer"&gt;learn.microsoft&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Prepare and Publish Your Report to Power BI Service
&lt;/h2&gt;

&lt;p&gt;Before you can embed a report, it must be published to the Power BI cloud service.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open your report in Power BI Desktop&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Make sure your &lt;code&gt;.pbix&lt;/code&gt; file is complete and saved. &lt;a href="https://dev.to/blinton_kiarie_906fad362c/how-to-publish-and-embed-a-power-bi-report-into-a-website-412"&gt;dev&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Click Publish&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
In the Home tab, click the &lt;strong&gt;Publish&lt;/strong&gt; button. &lt;a href="https://dev.to/blinton_kiarie_906fad362c/how-to-publish-and-embed-a-power-bi-report-into-a-website-412"&gt;dev&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sign in and select a workspace&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
If prompted, sign in to your Power BI account, then choose the workspace where you want to publish the report. &lt;a href="https://dev.to/blinton_kiarie_906fad362c/how-to-publish-and-embed-a-power-bi-report-into-a-website-412"&gt;dev&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Confirm the upload&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Once published, you’ll see a success message with a link to open the report in the Power BI service. &lt;a href="https://dev.to/blinton_kiarie_906fad362c/how-to-publish-and-embed-a-power-bi-report-into-a-website-412"&gt;dev&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 2: Generate the Embed Code
&lt;/h2&gt;

&lt;p&gt;You have two main options depending on whether you want the report to be publicly accessible or restricted to authenticated users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option A: Publish to Web (Public)
&lt;/h3&gt;

&lt;p&gt;Use this if you’re okay with anyone on the internet viewing your report—ideal for portfolios, blogs, or public dashboards. &lt;a href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-publish-to-web" rel="noopener noreferrer"&gt;learn.microsoft&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open your report in Power BI Service&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Go to &lt;a href="https://app.powerbi.com" rel="noopener noreferrer"&gt;app.powerbi.com&lt;/a&gt;, navigate to your workspace, and open the report. &lt;a href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-embed-secure" rel="noopener noreferrer"&gt;learn.microsoft&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Click File &amp;gt; Embed report &amp;gt; Publish to web (public)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
This opens the embed dialog. &lt;a href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-publish-to-web" rel="noopener noreferrer"&gt;learn.microsoft&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Review the warning&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Power BI will warn you that the report will be public. Confirm only if your data is safe to share. &lt;a href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-publish-to-web" rel="noopener noreferrer"&gt;learn.microsoft&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create embed code&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Click &lt;strong&gt;Create embed code&lt;/strong&gt;, then copy the &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; HTML snippet provided. &lt;a href="https://dev.to/blinton_kiarie_906fad362c/how-to-publish-and-embed-a-power-bi-report-into-a-website-412"&gt;dev&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Option B: Secure Embed (Website or Portal)
&lt;/h3&gt;

&lt;p&gt;Use this for internal dashboards where viewers must log in to Power BI. &lt;a href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-embed-secure" rel="noopener noreferrer"&gt;learn.microsoft&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open your report in Power BI Service&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Navigate to your workspace and open the report. &lt;a href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-embed-secure" rel="noopener noreferrer"&gt;learn.microsoft&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Click File &amp;gt; Embed report &amp;gt; Website or portal&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
This opens the secure embed dialog. &lt;a href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-embed-secure" rel="noopener noreferrer"&gt;learn.microsoft&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Copy the link or iframe code&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You can either copy the embed link or the &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; HTML snippet to paste into your site. &lt;a href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-embed-secure" rel="noopener noreferrer"&gt;learn.microsoft&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 3: Embed the Report on Your Website
&lt;/h2&gt;

&lt;p&gt;Now that you have the embed code, you can add it to your website.&lt;/p&gt;

&lt;h3&gt;
  
  
  For Custom HTML Sites
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open your HTML file&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Use a code editor like VS Code or your CMS editor. &lt;a href="https://dev.to/blinton_kiarie_906fad362c/how-to-publish-and-embed-a-power-bi-report-into-a-website-412"&gt;dev&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Paste the iframe code&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Insert the &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; snippet inside the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; section where you want the report to appear. &lt;a href="https://dev.to/blinton_kiarie_906fad362c/how-to-publish-and-embed-a-power-bi-report-into-a-website-412"&gt;dev&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Save and publish&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Upload the updated file to your web server or publish the changes in your CMS. &lt;a href="https://dev.to/blinton_kiarie_906fad362c/how-to-publish-and-embed-a-power-bi-report-into-a-website-412"&gt;dev&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  For WordPress or Other CMS Platforms
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open the page editor&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Go to the page where you want the report. &lt;a href="https://dev.to/billymuli/how-to-publish-a-power-bi-report-and-embed-it-into-a-website-3ng3"&gt;dev&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Add a Custom HTML block&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
In WordPress, insert a “Custom HTML” block. &lt;a href="https://dev.to/billymuli/how-to-publish-a-power-bi-report-and-embed-it-into-a-website-3ng3"&gt;dev&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Paste the iframe code&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Drop the code into the block and update or publish the page. &lt;a href="https://dev.to/billymuli/how-to-publish-a-power-bi-report-and-embed-it-into-a-website-3ng3"&gt;dev&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Important Considerations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data privacy&lt;/strong&gt;: Only use “Publish to web” if your report contains no sensitive or confidential data. &lt;a href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-publish-to-web" rel="noopener noreferrer"&gt;learn.microsoft&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Admin settings&lt;/strong&gt;: Your organization’s Power BI admin may need to enable “Publish to web” in the admin portal. &lt;a href="https://www.youtube.com/watch?v=Txm76K8mt6U" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Responsiveness&lt;/strong&gt;: You can adjust the &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; attributes in the iframe to fit your site’s layout. &lt;a href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-publish-to-web" rel="noopener noreferrer"&gt;learn.microsoft&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With these steps, your Power BI report will be live and interactive on your website, letting visitors explore your data in real time. &lt;a href="https://dev.to/blinton_kiarie_906fad362c/how-to-publish-and-embed-a-power-bi-report-into-a-website-412"&gt;dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>devto</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Machine Learning: The Invisible Helper</title>
      <dc:creator>Jonathan kip</dc:creator>
      <pubDate>Fri, 07 Aug 2026 10:55:37 +0000</pubDate>
      <link>https://dev.to/jonathan_kip/machine-learning-the-invisible-helper-in-your-daily-life-540l</link>
      <guid>https://dev.to/jonathan_kip/machine-learning-the-invisible-helper-in-your-daily-life-540l</guid>
      <description>&lt;h2&gt;
  
  
  Machine Learning: The Invisible Helper
&lt;/h2&gt;

&lt;p&gt;You probably use machine learning dozens of times a day without even realizing it.  From unlocking your phone with your face to getting uncannily accurate music recommendations, machine learning is the quiet intelligence powering the apps and devices you rely on every day. &lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Machine Learning
&lt;/h2&gt;

&lt;p&gt;Machine learning is a type of artificial intelligence that lets computers learn from experience instead of being programmed with rigid rules.  Instead of giving the computer step-by-step instructions, we feed it lots of examples—like photos, emails, or songs—and let it figure out the patterns on its own. &lt;a href="https://www.youtube.com/watch?v=vJLyQahV65c" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How Machine Learning Works: A Simple Breakdown
&lt;/h2&gt;

&lt;p&gt;You can think of machine learning as a four-step process that happens behind the scenes of your favorite apps. &lt;a href="https://www.youtube.com/watch?v=vJLyQahV65c" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Collect and Prepare Data
&lt;/h3&gt;

&lt;p&gt;Everything starts with data—numbers, photos, text, or sensor readings.  For example, Netflix gathers data on what you watch, when you pause, and what you rate.  This data is cleaned and organized so the computer can learn from it. &lt;a href="https://www.youtube.com/watch?v=vJLyQahV65c" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Train the Model
&lt;/h3&gt;

&lt;p&gt;A “model” is the brain the computer builds from the data.  Programmers choose an algorithm (a learning method) and feed it the training data.  The algorithm sifts through the examples, looking for patterns—like which words often appear in spam emails or which movies people who like action films also enjoy. &lt;a href="https://www.youtube.com/watch?v=vJLyQahV65c" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Test and Improve
&lt;/h3&gt;

&lt;p&gt;Before using the model in real life, it’s tested on new data it hasn’t seen before.  If it makes mistakes, engineers tweak it—adjusting settings or feeding it more data—until it gets better.  This is why your recommendations get smarter the more you use an app. &lt;a href="https://medium.com/@piyushacademypune/machine-learning-explained-in-simple-words-a-beginner-friendly-guide-3d7d8c14815a" rel="noopener noreferrer"&gt;medium&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Make Predictions
&lt;/h3&gt;

&lt;p&gt;Once trained, the model is deployed to make predictions or decisions on new inputs.  When a new email arrives, the spam filter uses its learned patterns to guess if it’s junk.  When you open Spotify, the recommendation engine predicts which songs you’ll like next. &lt;a href="https://www.youtube.com/watch?v=vJLyQahV65c" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Everyday Things You Use That Rely on Machine Learning
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Your Smartphone
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Face unlock&lt;/strong&gt;: The phone learns your facial features from many photos to securely unlock when it sees you.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Photo organization&lt;/strong&gt;: Apps like Google Photos group pictures by person or pet by learning visual patterns.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Predictive text and autocorrect&lt;/strong&gt;: Your keyboard learns your typing style to suggest words and fix mistakes.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Voice assistants&lt;/strong&gt;: Siri and Google Assistant use ML to understand your spoken commands and respond. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Streaming and Entertainment
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Netflix and YouTube recommendations&lt;/strong&gt;: These platforms analyze your watch history and compare it to millions of other users to suggest content. &lt;a href="https://medium.com/@amitvsolutions/machine-learning-101-the-complete-beginners-guide-to-machine-learning-686a30cbcf6b" rel="noopener noreferrer"&gt;medium&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spotify and Apple Music playlists&lt;/strong&gt;: “Discover Weekly” and “For You” mixes are built using ML that learns your listening habits.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Social media feeds&lt;/strong&gt;: Facebook, Instagram, and TikTok use ML to decide which posts and ads appear in your feed. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Email and Messaging
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Spam filters&lt;/strong&gt;: Gmail learns from emails labeled as “spam” or “not spam” to spot suspicious messages. &lt;a href="https://medium.com/@amitvsolutions/machine-learning-101-the-complete-beginners-guide-to-machine-learning-686a30cbcf6b" rel="noopener noreferrer"&gt;medium&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart replies&lt;/strong&gt;: Gmail suggests quick responses like “Thanks!” or “Sounds good” based on the email’s content.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto-transcription&lt;/strong&gt;: Apps like Slack and YouTube generate captions and transcriptions of spoken words. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Shopping and Online Services
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Product recommendations&lt;/strong&gt;: Amazon suggests items based on your browsing and purchase history.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delivery time estimates&lt;/strong&gt;: Apps predict when your food or package will arrive using traffic and order data.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chatbots&lt;/strong&gt;: Customer service bots on websites handle routine questions using ML-powered natural language processing. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Maps and Navigation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Google Maps and Waze&lt;/strong&gt;: These apps predict traffic jams, estimate travel times, and suggest the fastest routes.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ride-hailing apps&lt;/strong&gt;: Uber and Lyft use ML to match drivers with riders and set dynamic pricing. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Banking and Payments
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fraud alerts&lt;/strong&gt;: Your bank flags unusual transactions by learning your normal spending patterns.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Credit card approvals&lt;/strong&gt;: ML models assess risk when you apply for loans or credit cards. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Health and Fitness
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Step and workout tracking&lt;/strong&gt;: Fitness apps learn your activity patterns to give personalized goals.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Health insights&lt;/strong&gt;: Wearables detect irregular heartbeats or sleep issues using ML on sensor data. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why It Matters to You
&lt;/h2&gt;

&lt;p&gt;Machine learning makes your devices smarter, your apps more personalized, and your daily tasks easier.  It’s the reason your phone recognizes your face, your music app knows your mood, and your bank stops fraud before it hits your account.  In short, machine learning is the invisible helper that quietly powers the technology you use every single day.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>ai</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Understanding Data Modeling in Power BI: Joins, Relationships, and Schemas</title>
      <dc:creator>Jonathan kip</dc:creator>
      <pubDate>Sun, 29 Mar 2026 11:59:55 +0000</pubDate>
      <link>https://dev.to/jonathan_kip/understanding-data-modeling-in-power-bi-joins-relationships-and-schemas-106c</link>
      <guid>https://dev.to/jonathan_kip/understanding-data-modeling-in-power-bi-joins-relationships-and-schemas-106c</guid>
      <description>&lt;p&gt;&lt;strong&gt;Power BI&lt;/strong&gt; is a platform that enables users to connect to various data sources, transform data, create interactive visualizations, and share insights through dashboards and reports.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data modeling&lt;/strong&gt;  refers to the process of defining how tables connect, interact, and filter each other to enable accurate calculations, fast performance, and intuitive reporting.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;SQL JOINS&lt;/strong&gt;     &lt;/u&gt;                                                   &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;INNER JOIN&lt;/strong&gt;&lt;/em&gt;-Returns matching rows from both tables.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;LEFT JOIN&lt;/strong&gt;&lt;/em&gt;-All rows from left table, matching from right, NULLs for no match. &lt;br&gt;
&lt;em&gt;&lt;strong&gt;RIGHT JOIN&lt;/strong&gt;&lt;/em&gt;-All rows from right table, matching from left, NULLs for no match.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;FULL OUTER&lt;/strong&gt;&lt;/em&gt;-All rows from both, NULLs where no match.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;LEFT ANTI&lt;/strong&gt;&lt;/em&gt;-Rows in left table with no match in right.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;RIGHT ANTI&lt;/strong&gt;&lt;/em&gt;-Rows in right table with no match in left. &lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;POWERBI RELATIONSHIP&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;
Power BI relationships connect tables in the data model to enable dynamic filtering and accurate aggregations across visuals without physically merging data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Relationship Cardinality&lt;/strong&gt;&lt;br&gt;
Cardinality defines how many rows in one table match rows in another.&lt;/p&gt;

&lt;p&gt;1:1 (One-to-One): Each row in Table A matches exactly one row in Table B (e.g., Employee to EmployeeDetails via unique EmployeeID); rare, used for normalized data or security filtering.&lt;/p&gt;

&lt;p&gt;1:M (One-to-Many): One row in Table A matches multiple in Table B (e.g., Product to Sales via ProductID); standard for star schemas.&lt;/p&gt;

&lt;p&gt;M:M (Many-to-Many): Multiple rows in both tables match (e.g., Students to Classes); avoid direct M:M—instead use a bridge table for performance and clarity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Active vs Inactive Relationships&lt;/strong&gt;&lt;br&gt;
Active: Default, single relationship per table pair; filter context propagates automatically in visuals and DAX (solid line).&lt;/p&gt;

&lt;p&gt;Inactive: Additional relationships (dashed line); ignored by default—activate via USERELATIONSHIP() DAX function for specific measures (e.g., role-playing dates).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cross-Filter Direction&lt;/strong&gt;&lt;br&gt;
Controls filter propagation:&lt;/p&gt;

&lt;p&gt;Single: Filters flow one way (default for 1:M, e.g., Dimension → Fact).&lt;/p&gt;

&lt;p&gt;Both: Bi-directional (e.g., Fact ↔ Dimension); use cautiously to avoid ambiguity or performance hits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The difference between joins and relationships&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F41vtf35tezifk3vadtql.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F41vtf35tezifk3vadtql.png" alt="The difference between joins and relationships" width="688" height="262"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fact vs Dimension Tables&lt;/strong&gt;&lt;br&gt;
Fact tables store quantitative metrics (e.g., SalesAmount, Quantity) with foreign keys to dimensions; they grow vertically with transactions.&lt;/p&gt;

&lt;p&gt;Dimension tables hold descriptive attributes (e.g., ProductName, CustomerCity) with hierarchies; they grow horizontally and less frequently.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Star Schema&lt;/em&gt;: Central fact table surrounded by denormalized dimension tables; simplest and fastest for Power BI queries.&lt;br&gt;
Use Case: Sales dashboards needing quick slicing by product/customer.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Snowflake Schema&lt;/em&gt;: Dimensions normalized into sub-tables (e.g., Product → Category); saves storage but slower joins.&lt;br&gt;
Use Case: Data warehouses with complex hierarchies; avoid in pure Power BI models.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Flat Table (DLAT)&lt;/em&gt;: Single denormalized table blending facts/dimensions; easy but inefficient for filtering.&lt;br&gt;
Use Case: Small, simple datasets before unpivoting into star schema.&lt;/p&gt;

&lt;p&gt;Role-Playing Dimensions&lt;br&gt;
A single dimension (e.g., Date table) connects to a fact table multiple times for different roles (OrderDate, ShipDate). Use inactive relationships + USERELATIONSHIP() DAX to activate contextually.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Modeling Issues&lt;/strong&gt;&lt;br&gt;
Circular dependencies: Resolved by star schema or inactive relationships.&lt;br&gt;
Bi-directional filter loops: Set single direction.&lt;br&gt;
Wrong cardinality: Causes incorrect aggregations; verify in properties.&lt;br&gt;
Ambiguous paths: Hide unused columns or use bridge tables.&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>sql</category>
      <category>tutorial</category>
      <category>powebi</category>
    </item>
  </channel>
</rss>
