0% found this document useful (0 votes)
16 views9 pages

Email Spam Perceptron Example

The document outlines a step-by-step process for classifying emails as Spam or Not Spam using a Perceptron model based on specific features. It details the input values, weight calculations, and the activation function used to determine the output. Additionally, it discusses the weight update rule for improving predictions over time and emphasizes the importance of feature engineering in spam detection systems.

Uploaded by

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

Email Spam Perceptron Example

The document outlines a step-by-step process for classifying emails as Spam or Not Spam using a Perceptron model based on specific features. It details the input values, weight calculations, and the activation function used to determine the output. Additionally, it discusses the weight update rule for improving predictions over time and emphasizes the importance of feature engineering in spam detection systems.

Uploaded by

Kranium A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Real-Life Example: Email Spam

Detection
Using a Perceptron - Step-by-Step
Problem Setup
• Goal: Classify emails as Spam (1) or Not Spam
(0) using features:
• - x1: 'FREE' in email
• - x2: 'CLICK' in email
• - x3: Subject line in ALL CAPS
Inputs and Initial Weights
• Example 1:
• - x1 = 1 (Yes)
• - x2 = 1 (Yes)
• - x3 = 0 (No)

• Weights:
• - w1 = 0.5
• - w2 = 0.4
• - w3 = 0.3
Compute Weighted Sum
• Weighted Sum = (0.5×1) + (0.4×1) + (0.3×0) +
(-0.6)
• = 0.3
Activation and Output
• Step Activation Function:
• If Weighted Sum ≥ 0, Output = 1 (Spam)
• If Weighted Sum < 0, Output = 0 (Not Spam)

• Result: 0.3 ≥ 0 → Spam


What If Prediction is Wrong?
• Weight Update Rule:
• Δw = η × (y_true - y_predicted) × x

• Adjust weights if prediction ≠ true label.


Training Over Many Emails
• Over time:
• - Increase weights for spam indicators
• - Decrease weights for non-spam features

• Perceptron 'learns' important features.


Visualization Idea
• Plot emails:
• - X-axis: 'FREE'
• - Y-axis: 'CLICK'

• Draw decision boundary to separate Spam and


Not Spam.
Practical Notes
• - Real spam filters use thousands of features.
• - Good feature engineering is key.
• - Modern systems use advanced deep learning
models.

You might also like