Fast incremental update of the mean and covariance in Python
问题 I have a Python script where I need to frequently update the mean and co-variance matrix. What I am currently doing is that each time I get a new data point $x$ (a vector), I recompute the mean and covariance as follows: data.append(x) # My `data` is just a list of lists of floats (i.e., x is a list of floats) self.mean = np.mean( data, axis=0) # self.mean is a list representing the center of data self.cov = np.cov( data, rowvar=0) The problem is that is not fast enough for me. Is there