The following is the official documentation links
numpy.random.multivariate_normal
- 1. The function definition
numpy.random.multivariate_normal (mean, cov [, size , check_valid, tol]) - 2.参数解释
Parameters:
mean : 1-D array_like, of length N
Mean of the N-dimensional distribution.
cov : 2-D array_like, of shape (N, N)
Covariance matrix of the distribution. It must be symmetric and positive-semidefinite for proper sampling.
size : int or tuple of ints, optional
Given a shape of, for example, (m,n,k), mnk samples are generated, and packed in an m-by-n-by-k arrangement. Because each sample is N-dimensional, the output shape is (m,n,k,N). If no shape is specified, a single (N-D) sample is returned.
check_valid : { ‘warn’, ‘raise’, ‘ignore’ }, optional
Behavior when the covariance matrix is not positive semidefinite.
tol : float, optional
Tolerance when checking the singular values in covariance matrix.
1 | 2 |
---|---|
mean | It represents mean Gaussian distribution, mean latitude N, the N-dimensional Gaussian distribution |
conv | It denotes the covariance matrix of Gaussian distribution, one-dimensional Gaussian covariance matrix latitude 1 1. two-dimensional Gaussian covariance matrix latitude 2 2 ... |
size | conv mean and define a Gaussian distribution, a Gaussian distribution function is good in generating a plurality of values is defined, if the size of (m, n, k), it returns a sample value (m, n, k) of size |
check_valid | Inspection covariance matrix, when the matrix is not positive semi-timer, warning output, ignored, raise ..... |
toll | When the tolerance of the covariance matrix of singular values to be checked, when the test should be the covariance matrix of singular values of the error determination |
- 3.使用
(1)
'''
import numpy as np
import matplotlib.pyplot as plt
Y = np.random.multivariate_normal([(0)], [[1]], 1000)
plt.plot(Y,'ro')
'''
1000 points collected in line with zero mean Gaussian distribution, a covariance, the vertical axis represents the sequence number value in FIG acquired point, the horizontal axis represents the point can be seen that the value of all the points is substantially in line with N (0,1 )Separate.