Expected Value: Summarizes Average Behavior

Expected Value: Summarizes Average Behavior#

In data science, we often care less about a single outcome and more about the long-run average behavior of a process. This idea is captured by expected value.


Mathematically: Expected Value

For a discrete random variable \(X\):

\(\mathbb{E}[X] = \sum_x x \, P(X = x)\)

For a continuous random variable \(X\) with density \(f(x)\):

\(\mathbb{E}[X] = \int_{-\infty}^{\infty} x f(x)\,dx\)

Intuition:

  • Expected value is not a guaranteed outcome

  • It represents the average result over many repetitions

  • It can be positive, zero, or negative

A negative expected value means a process loses value on average
(e.g., average loss, cost, or error).

In data science, expected value connects directly to: -average error -average loss -average reward

This is why it plays a central role in optimization, decision-making, and model evaluation.

#Small Python Simulation
#Bernoulli example (click or no click):

import numpy as np

np.random.seed(1)
p = 0.2
samples = np.random.binomial(n=1, p=p, size=50_000)

print("Empirical mean:", samples.mean())
print("Expected value:", p)
Empirical mean: 0.1994
Expected value: 0.2