in svinfer/summary_statistics/summary_statistics.py [0:0]
def estimate_moments(self, x_moments):
"""
Estimate the 1st, 2nd, 3rd, 4th (raw) moments for underlying the data,
given the moments of the corresponding noisy data.
:param moments: a list of numeric values
:return: a list of numeric values
"""
# the 0th, 1st, 2nd, 3rd, 4th moments of a normal distribution
# with variance self.s2
noise_moments = [1, 0, self.s2, 0, 3 * self.s2 ** 2]
a = np.zeros([4, 4])
for i in range(4):
for j in range(i + 1):
a[i, j] = special.comb(i + 1, j + 1) * noise_moments[i - j]
b = np.array(x_moments) - np.array(noise_moments[1:])
z_moments = linalg.solve(a, b)
return z_moments