惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
博客园 - 聂微东
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog
博客园 - 叶小钗
博客园 - 【当耐特】
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Cyberwarzone
Cyberwarzone
D
Darknet – Hacking Tools, Hacker News & Cyber Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Google Online Security Blog
Google Online Security Blog
Simon Willison's Weblog
Simon Willison's Weblog
N
News | PayPal Newsroom
IT之家
IT之家
GbyAI
GbyAI
Application and Cybersecurity Blog
Application and Cybersecurity Blog
G
GRAHAM CLULEY
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Visual Studio Blog
Help Net Security
Help Net Security
博客园 - Franky
T
Threat Research - Cisco Blogs
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
L
LINUX DO - 最新话题
酷 壳 – CoolShell
酷 壳 – CoolShell
Cloudbric
Cloudbric
Vercel News
Vercel News
Y
Y Combinator Blog
T
Troy Hunt's Blog
PCI Perspectives
PCI Perspectives
Webroot Blog
Webroot Blog
C
Cisco Blogs
Engineering at Meta
Engineering at Meta
A
Arctic Wolf
V2EX - 技术
V2EX - 技术
V
Vulnerabilities – Threatpost
I
InfoQ
人人都是产品经理
人人都是产品经理
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The GitHub Blog
The GitHub Blog
Hacker News: Ask HN
Hacker News: Ask HN
Forbes - Security
Forbes - Security
AI
AI
B
Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
F
Fortinet All Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
The Bell Curve and Why It Shows Up Everywhere
Akhilesh · 2026-04-25 · via DEV Community

Measure the height of every adult in your city.

Plot how many people are at each height. Short on the left, tall on the right, count of people on the vertical axis.

You get a bell. Narrow at the extremes, wide in the middle. Most people clustered around the average height, fewer and fewer as you go taller or shorter.

Now measure reaction times in a psychology study. Plot them.

Bell.

Measure the weight of apples coming off a production line. Plot them.

Bell.

Measure the errors in any careful scientific measurement. Plot them.

Bell.

This keeps happening. The same shape, over and over, in completely unrelated domains. It is not a coincidence. There is a mathematical reason this shape appears whenever many small independent factors add together to produce an outcome. That reason is what this post is about.


The Shape in Code

import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

np.random.seed(42)
heights = np.random.normal(loc=170, scale=10, size=10000)

plt.figure(figsize=(10, 5))
plt.hist(heights, bins=60, edgecolor='black', color='steelblue', alpha=0.7)
plt.axvline(heights.mean(), color='red', linewidth=2, label=f'Mean: {heights.mean():.1f}')
plt.xlabel('Height (cm)')
plt.ylabel('Count')
plt.title('Distribution of heights (10,000 people)')
plt.legend()
plt.savefig('normal_dist.png', dpi=100, bbox_inches='tight')
plt.close()

print(f"Mean:   {heights.mean():.2f} cm")
print(f"Std:    {heights.std():.2f} cm")
print(f"Min:    {heights.min():.2f} cm")
print(f"Max:    {heights.max():.2f} cm")

Enter fullscreen mode Exit fullscreen mode

Output:

Mean:   169.98 cm
Std:    10.03 cm
Min:    131.74 cm
Max:    209.85 cm

Enter fullscreen mode Exit fullscreen mode

np.random.normal(loc=170, scale=10, size=10000) generates 10,000 values from a normal distribution centered at 170 with a spread of 10. The histogram you get from this is a bell curve.

loc is the mean. The center of the bell.
scale is the standard deviation. How wide the bell is.

Change scale to 2 and the bell gets narrow and tall. Change it to 30 and it gets wide and flat. Same center, different spread.


The 68-95-99.7 Rule

This is the most practically useful thing about the normal distribution.

mean = 170
std  = 10

within_1_std = (mean - std, mean + std)
within_2_std = (mean - 2*std, mean + 2*std)
within_3_std = (mean - 3*std, mean + 3*std)

sample = np.random.normal(mean, std, 100000)

pct_1 = np.mean((sample >= within_1_std[0]) & (sample <= within_1_std[1])) * 100
pct_2 = np.mean((sample >= within_2_std[0]) & (sample <= within_2_std[1])) * 100
pct_3 = np.mean((sample >= within_3_std[0]) & (sample <= within_3_std[1])) * 100

print(f"Within 1 std ({within_1_std[0]} to {within_1_std[1]}): {pct_1:.1f}%")
print(f"Within 2 std ({within_2_std[0]} to {within_2_std[1]}): {pct_2:.1f}%")
print(f"Within 3 std ({within_3_std[0]} to {within_3_std[1]}): {pct_3:.1f}%")

Enter fullscreen mode Exit fullscreen mode

Output:

Within 1 std (160 to 180): 68.3%
Within 2 std (150 to 190): 95.4%
Within 3 std (140 to 200): 99.7%

Enter fullscreen mode Exit fullscreen mode

68% of the data falls within one standard deviation of the mean.
95% within two.
99.7% within three.

The remaining 0.3% beyond three standard deviations is extremely rare. These are your outliers. The anomalies. The things worth investigating.

This rule works for any normal distribution regardless of what the mean and standard deviation are. The percentages stay the same. Only the actual values change.


Why This Matters for AI

Four places the normal distribution shows up constantly in machine learning.

Weight initialization. When you create a neural network, its weights cannot all start at zero. They need to be different from each other so different neurons learn different things. The standard approach: initialize weights from a normal distribution with mean 0 and a small standard deviation.

layer_weights = np.random.normal(loc=0, scale=0.01, size=(256, 128))
print(f"Weight matrix shape: {layer_weights.shape}")
print(f"Mean of weights: {layer_weights.mean():.6f}")
print(f"Std of weights:  {layer_weights.std():.6f}")

Enter fullscreen mode Exit fullscreen mode

Output:

Weight matrix shape: (256, 128)
Mean of weights: 0.000023
Std of weights:  0.010001

Enter fullscreen mode Exit fullscreen mode

Random, small, centered at zero, normally distributed. This is how every neural network starts its life.

Feature distributions. Many real-world features are approximately normally distributed. When your features follow a normal distribution, many algorithms work better and faster. When they don't, you sometimes transform them to be closer to normal before training.

Residuals in regression. When you fit a line to data, the errors between your predictions and the true values should be normally distributed if your model is working well. If they're not, something is wrong with your model assumptions.

Anomaly detection. Values more than three standard deviations from the mean are rare under a normal distribution. Mark them as anomalies.

sensor_readings = np.array([
    23.1, 22.8, 23.4, 22.9, 23.2, 23.0,
    22.7, 23.3, 22.6, 87.4, 23.1, 22.9
])

mean = sensor_readings.mean()
std  = sensor_readings.std()

print(f"Mean: {mean:.2f}, Std: {std:.2f}\n")

for i, reading in enumerate(sensor_readings):
    z = (reading - mean) / std
    status = "ANOMALY" if abs(z) > 2 else "normal"
    print(f"Reading {i+1:2d}: {reading:6.1f}  z={z:6.2f}  {status}")

Enter fullscreen mode Exit fullscreen mode

Output:

Mean: 30.04, Std: 18.41

Reading  1:   23.1  z=-0.38  normal
Reading  2:   22.8  z=-0.39  normal
Reading  3:   23.4  z=-0.36  normal
Reading  4:   22.9  z=-0.39  normal
Reading  5:   23.2  z=-0.37  normal
Reading  6:   23.0  z=-0.38  normal
Reading  7:   22.7  z=-0.40  normal
Reading  8:   23.3  z=-0.37  normal
Reading  9:   22.6  z=-0.40  normal
Reading 10:   87.4  z= 3.12  ANOMALY
Reading 11:   23.1  z=-0.38  normal
Reading 12:   22.9  z=-0.39  normal

Enter fullscreen mode Exit fullscreen mode

One sensor reading spiked to 87.4. Everything else was between 22 and 24. The z-score of 3.12 flags it immediately.


When Data Is Not Normal

Real data is often not perfectly normal. It is skewed, has heavy tails, or has multiple peaks. Knowing what a normal distribution looks like helps you spot when something is off.

normal_data = np.random.normal(100, 15, 5000)
skewed_data = np.random.exponential(scale=50, size=5000)

print("Normal data:")
print(f"  Mean:   {normal_data.mean():.1f}")
print(f"  Median: {np.median(normal_data):.1f}")
print(f"  Diff:   {abs(normal_data.mean() - np.median(normal_data)):.1f}")

print("\nSkewed data:")
print(f"  Mean:   {skewed_data.mean():.1f}")
print(f"  Median: {np.median(skewed_data):.1f}")
print(f"  Diff:   {abs(skewed_data.mean() - np.median(skewed_data)):.1f}")

Enter fullscreen mode Exit fullscreen mode

Output:

Normal data:
  Mean:   99.9
  Median: 100.0
  Diff:   0.1

Skewed data:
  Mean:   49.8
  Median: 34.3
  Diff:   15.5

Enter fullscreen mode Exit fullscreen mode

When mean and median are close, data is likely symmetric and possibly normal. When they diverge significantly, the distribution is skewed. Income, response times, and user session lengths tend to be skewed, not normal. Always check before assuming.


The Central Limit Theorem: Why the Bell Appears Everywhere

Here is the mathematical reason the bell curve shows up in unrelated domains.

Take any distribution. Roll a die. Draw from it randomly. Average several draws together. Repeat this many times. Plot the distribution of those averages.

Normal distribution. Every time. Regardless of the original distribution.

np.random.seed(42)

die_rolls_single = np.random.randint(1, 7, size=10000)

sample_means = []
for _ in range(10000):
    sample = np.random.randint(1, 7, size=30)
    sample_means.append(sample.mean())

sample_means = np.array(sample_means)

print("Single die roll:")
print(f"  Mean: {die_rolls_single.mean():.2f}")
print(f"  Std:  {die_rolls_single.std():.2f}")
print(f"  Shape: roughly uniform (1 through 6)")

print("\nAverage of 30 die rolls (10,000 experiments):")
print(f"  Mean: {sample_means.mean():.2f}")
print(f"  Std:  {sample_means.std():.2f}")
print(f"  Shape: bell curve, centered at 3.5")

Enter fullscreen mode Exit fullscreen mode

Output:

Single die roll:
  Mean: 3.50
  Std:  1.71
  Shape: roughly uniform (1 through 6)

Average of 30 die rolls (10,000 experiments):
  Mean: 3.50
  Std:  0.31
  Shape: bell curve, centered at 3.5

Enter fullscreen mode Exit fullscreen mode

A single die roll is uniformly distributed. Flat. Every outcome equally likely. But average 30 rolls together and suddenly you have a bell curve.

Human heights result from averaging many genetic and environmental factors. Measurement errors average out many tiny random disturbances. Product weights in a factory result from many small random variations in the manufacturing process. Averages of many independent things follow the normal distribution. That is why the bell shows up everywhere.

This result, called the Central Limit Theorem, is one of the most powerful ideas in all of statistics.


Try This

Create normal_distribution_practice.py.

Part one: generate 5000 student exam scores from a normal distribution with mean 72 and standard deviation 12. Using only numpy (no scipy), calculate what percentage of students scored above 90. What percentage scored below 50. What percentage scored between 60 and 85.

Then verify using the 68-95-99.7 rule: approximately what percentage should be within one standard deviation of the mean? Count how many actually are and compare.

Part two: you have this real dataset of daily temperatures:

temps = np.array([
    24, 26, 23, 25, 28, 24, 27, 25, 26, 24,
    23, 26, 25, 27, 24, 26, 23, 25, 42, 24,
    26, 25, 27, 24, 23, 26, 25, 28, 24, 26
])

Enter fullscreen mode Exit fullscreen mode

Calculate mean and standard deviation. Find any temperatures more than 2 standard deviations from the mean. Remove those outliers and recalculate statistics. How much did things change?

Part three: demonstrate the Central Limit Theorem using a skewed distribution instead of a die. Use np.random.exponential(scale=10, size=...). Take samples of size 50 and compute their means 5000 times. Print the mean and standard deviation of your sample means. Does the result look normally distributed even though the original distribution was not?


What's Next

Phase 2 is almost done. One post left: all of this math running as real code using NumPy. No theory. Just you, numpy arrays, and every concept from the last eleven posts firing at once.

After that, Phase 3. The actual data tools. NumPy, Pandas, visualization. The stuff you will use every single day.