numpy.cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=None)[source] Estimate a covariance matrix, given data and weights. Covariance indicates the level to which two variables vary together. If we examine N-dimensional samp…
numpy.ravel(a, order='C') Return a flattened array numpy.chararray.flatten(order='C') Return a copy of the array collapsed into one dimension numpy.squeeze(a, axis=None) Remove single-dimensional entries from the shape of an array. 相同点: 将多维数组 降为 一维数组…
生成多维高斯分布随机样本 生成多维高斯分布所需要的均值向量和方差矩阵 这里使用numpy中的多变量正太分布随机样本生成函数,按照要求设置均值向量和协方差矩阵.以下设置两个辅助函数,用于指定随机变量维度,生成相应的均值向量和协方差矩阵. import numpy as np from numpy.random import multivariate_normal from math import sqrt 均值向量生成函数 输入: n:指定随机样本的维度 输出: m1,m2:正类样本和负类样本的均…