The arithmetic mean is widely used in financial engineering for calculating averages of asset returns, prices, and other financial metrics. In machine learning, it is a fundamental operation for calculating the central tendency of data, which is essential for many algorithms and models.
AM(x1,x2,…,xn)=n1i=1∑nxi
To implement the Mean function, see the method signature below. Precision represents the number of decimal places and can be set between 0 and 18. It is applied to nums, weights and the output.