Weighted Mean
A plain average treats every data point as equally important. A weighted mean is what you use when that’s not true—when some values should count more than others because they’re more reliable, more frequent, or more relevant.
What it is (and the simple formula)
The weighted mean is an average where each value x is multiplied by a weight w, then you divide by the total weight:
weighted_mean = (Σ w_i x_i) / (Σ w_i)
If all weights are equal, this collapses to the regular arithmetic mean. Weights are often nonnegative, and many workflows use normalized weights that sum to 1, making the denominator 1.
Intuition: “votes with different power”
Think of each data point as casting votes. In a regular mean, everyone gets one vote. In a weighted mean, some points get more votes—maybe because you observed them more times, or because you trust them more.
Everyday examples
- Exam grades: Homework 20%, midterm 30%, final 50%. The course grade is a weighted mean of scores.
- House prices: Average price per neighborhood weighted by number of sales, so tiny neighborhoods don’t distort the citywide “typical” price.
- Sensor readings: Combine measurements weighted by inverse variance—more precise sensors influence the mean more.
Why it matters in AI/ML
Weighted means show up everywhere:
- Imbalanced datasets: Many libraries (e.g., scikit-learn) use sample weights so rare classes matter during training and evaluation.
- Loss functions: Weighted averaging of errors lets you prioritize costly mistakes (like false negatives in medical screening).
- Ensembles: Some models combine predictions as a weighted mean of base learners’ outputs.
Without weighting, your “average” can quietly reflect the loudest or most common cases, not the ones you actually care about.
Weighted Mean is an average where each value contributes in proportion to an assigned weight, computed as \(\sum w_i x_i / \sum w_i\). It is important in AI/ML because it summarizes data when observations have different reliability, frequency, or importance, and underlies many estimators and loss-weighting schemes. Example: computing a class-imbalance-aware average loss by weighting minority-class errors more heavily than majority-class errors.
Imagine you’re rating a restaurant: your opinion matters, but your friend who eats there every week probably should count more. A weighted mean works the same way—it’s an average where some values get more “importance” (more weight) than others.
In regular averages, every number counts equally. In a weighted mean, you multiply each value by its weight, add those up, and then divide by the total weight. In AI and machine learning, this is useful when some data points are more reliable, more recent, or represent more people, so they should influence the “typical” value more.