The sample mean (or, average) of given numbers [latex]x_1, \cdots, x_n[/latex], is defined as
[latex]\begin{align*} \hat{x} &:= \frac{1}{n} (x_1 + \cdots + x_n). \end{align*}[/latex]
The sample average can be interpreted as a scalar product:
[latex]\begin{align*} \hat{x} &= p^T x. \end{align*}[/latex]
where [latex]x = (x_1, \cdots, x_n)[/latex] is the vector containing the samples, and [latex]p = (1/n){\bf 1}[/latex], with [latex]{\bf 1}[/latex] the vector of ones.
More generally, for any vector [latex]p \in \mathbb{R}^n[/latex], with [latex]p_i \ge 0[/latex] for every [latex]i[/latex], and [latex]p_1 + \cdots + p_n = 1[/latex], we can define the corresponding weighted average as [latex]p^Tx[/latex]. The interpretation of [latex]p[/latex] is in terms of a discrete probability distribution of a random variable [latex]X[/latex], which takes the value [latex]x_i[/latex] with probability [latex]p_i[/latex], [latex]i = 1, \cdots, n[/latex]. The weighted average is then simply the expected value (or, mean) of [latex]X[/latex] under the probability distribution [latex]p[/latex]. The expected value is often denoted [latex]{\bf E}_p(X)[/latex], or [latex]{\bf E}(X)[/latex] if the distribution [latex]p[/latex] is clear from context.