欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

高斯密度与3西格玛检验

程序员文章站 2022-07-07 19:31:11
import numpy as npimport matplotlib.pyplot as pltdef normal_distribution1(mu=0,sigma=1,space=1000): x = np.linspace(mu-(3*sigma-(-3*sigma)),mu+(3*sigma-(-3*sigma)),space) return 1/(np.sqrt(2*np.pi) * sigma) * np.exp(-1*((x-mu)**2)/(2*(sigma**2)...
import numpy as np
import matplotlib.pyplot as plt

def normal_distribution1(mu=0,sigma=1,space=1000):
    x =  np.linspace(mu-(3*sigma-(-3*sigma)),mu+(3*sigma-(-3*sigma)),space)
    return 1/(np.sqrt(2*np.pi) * sigma) * np.exp(-1*((x-mu)**2)/(2*(sigma**2)))
    
def three_sigm_criteria(normalx):
    mu = normalx.mean()
    std = normalx.std()
    def check_sigm_n(n):
        tmp1 = mu-std <= normalx
        n1 = tmp1.size
        tmp2 = normalx[tmp1]<=(mu+n*std)
        n2 = tmp2.size
        return tmp2.dot(np.ones(n2))/n2
    return {"{}{}".format("sigm",i):(check_sigm_n(i)>v,check_sigm_n(i)) for i,v in zip(range(1,4),(0.6827,0.9545,0.9973))}


three_sigm_criteria(normal_distribution2(0,1))

高斯密度与3西格玛检验

本文地址:https://blog.csdn.net/weixin_43069769/article/details/107154789