当前位置: 首页>>代码示例>>Python>>正文


Python stats.std函数代码示例

本文整理汇总了Python中stats.std函数的典型用法代码示例。如果您正苦于以下问题:Python std函数的具体用法?Python std怎么用?Python std使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了std函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: log

    def log(self):
        mean_download_rate = stats.avg(self.download_rates)
        std_download_rate = stats.std(self.download_rates)

        mean_upload_rate = stats.avg(self.upload_rates)
        std_upload_rate = stats.std(self.upload_rates)

        logger.log("--*--Torrent statistics--*--")
        logger.log("Download rate (KiB/s) - mean: %f" % mean_download_rate)
        logger.log("Download rate (KiB/s) - standard deviation: %f" % std_download_rate)
        logger.log("Upload rate (KiB/s) - mean: %f" % mean_upload_rate)
        logger.log("Upload rate (KiB/s) - standard deviation: %f" % std_upload_rate)

        logger.log_to_file("download_rate_mean, %f\r\n" % mean_download_rate)
        logger.log_to_file("download_rate_stdev, %f\r\n" % std_download_rate)
        logger.log_to_file("upload_rate_mean, %f\r\n" % mean_upload_rate)
        logger.log_to_file("upload_rate_stdev, %f\r\n" % std_upload_rate)

        if self.download_finished:
            logger.log("Download time (s): %d" % self.download_time)
            logger.log_to_file("download_time, %d\r\n" % self.download_time)
        else:
            logger.log_to_file("download_time, %d\r\n" % -1)

        self.buffer_manager.log()
开发者ID:gabrielgmendonca,项目名称:btstream,代码行数:25,代码来源:videotorrentplayer.py

示例2: check_2d

 def check_2d(self):
     a = [[1.0, 2.0, 3.0],
          [2.0, 4.0, 6.0],
          [8.0, 12.0, 7.0]]
     b1 = array((3.7859388972001824, 5.2915026221291814,
                 2.0816659994661335))
     b2 = array((1.0,2.0,2.64575131106))
     assert_array_almost_equal(stats.std(a),b1,11)
     assert_array_almost_equal(stats.std(a,axis=0),b1,11)
     assert_array_almost_equal(stats.std(a,axis=1),b2,11)
开发者ID:mbentz80,项目名称:jzigbeercp,代码行数:10,代码来源:test_stats.py

示例3: print_stats

def print_stats(L):
    """ Display some information about the lists """

    print "Let's compute some statistics..."
    print "\tMean: %d" % mean(L)
    print "\tStandard deviation: %d" % std(L)
    print "\t# of outliers: %d" % (len(L) - len(remove_outliers(L,1)))
开发者ID:Rhomboidal1,项目名称:CS301-Lab,代码行数:7,代码来源:t_test.py

示例4: log

    def log(self):
        interruptions = len(self.buffering_time) - 1

        # Checking if player is on initial buffering state
        if interruptions > 0 or not self.is_buffering:
            initial_wait = self.buffering_time[0]
        else:
            initial_wait = -1

        # Removing invalid samples
        buffering_time = self.buffering_time[1:]
        if self.is_buffering:
            buffering_time = buffering_time[:-1]

        # Calculating statistics
        mean_time = stats.avg(buffering_time)
        std_time = stats.std(buffering_time)

        # Logging
        logger.log("--*--Buffer statistics--*--")
        logger.log("Time to start playback (s): %d" % initial_wait)
        logger.log("Number of interruptions: %d" % interruptions)
        logger.log("Interruption time (s) - mean: %f" % mean_time)
        logger.log("Interruption time (s) - standard deviation: %f" % std_time)
        logger.log("Interruptions (s): %r" % buffering_time)

        logger.log_to_file("playback_start_time, %d\r\n" % initial_wait)
        logger.log_to_file("interruptions, %d\r\n" % interruptions)
        logger.log_to_file("interruption_time_mean, %f\r\n" % mean_time)
        logger.log_to_file("interruption_time_stdev, %f\r\n" % std_time)
开发者ID:gabrielgmendonca,项目名称:btstream,代码行数:30,代码来源:buffermanager.py

示例5: test_std5

def test_std5():
	obs = std([1.0, 1.0, 1.0])
	exp = 0.0
	assert_equal(obs,exp)
	
#test_mean()
#test_float_mean()
#test_negative_mean()
开发者ID:dgellerup,项目名称:simplestats,代码行数:8,代码来源:test_stats.py

示例6: test_std7

def test_std7():
    obs = std([0.0, 1e4242])
    exp = NotImplemented
    assert_equal(obs, exp)
开发者ID:CongliSun,项目名称:swcarpentry-workflows-in-practice,代码行数:4,代码来源:test_stats.py

示例7: test_std5

def test_std5():
    obs = std([1.0, 1.0, 1.0])
    exp = 0.0
    assert_equal(obs, exp)
开发者ID:CongliSun,项目名称:swcarpentry-workflows-in-practice,代码行数:4,代码来源:test_stats.py

示例8: test_std6

def test_std6():
    obs = std([1e500])
    exp = NotImplemented
    assert_equal(obs, exp)
开发者ID:CongliSun,项目名称:swcarpentry-workflows-in-practice,代码行数:4,代码来源:test_stats.py

示例9: test_std3

def test_std3():
    obs = std([0.0, 4.0])
    exp = 2.0
    assert_equal(obs, exp)
开发者ID:CongliSun,项目名称:swcarpentry-workflows-in-practice,代码行数:4,代码来源:test_stats.py

示例10: test_std4

def test_std4():
    obs = std([1.0, 3.0])
    exp = 1.0
    assert_equal(obs, exp)
开发者ID:CongliSun,项目名称:swcarpentry-workflows-in-practice,代码行数:4,代码来源:test_stats.py

示例11: test_std1

def test_std1():
    obs = std([0.0, 2.0])
    exp = 1.0
    assert_equal(obs, exp)
开发者ID:CongliSun,项目名称:swcarpentry-workflows-in-practice,代码行数:4,代码来源:test_stats.py

示例12: test_std2

def test_std2():
    obs = std([])
    exp = 0.0
    assert_equal(obs, exp)
开发者ID:CongliSun,项目名称:swcarpentry-workflows-in-practice,代码行数:4,代码来源:test_stats.py

示例13: anderson

def anderson(x,dist='norm'):
    """Anderson and Darling test for normal, exponential, or Gumbel
    (Extreme Value Type I) distribution.

    Given samples x, return A2, the Anderson-Darling statistic,
    the significance levels in percentages, and the corresponding
    critical values.

    Critical values provided are for the following significance levels
    norm/expon:   15%, 10%, 5%, 2.5%, 1%
    Gumbel:       25%, 10%, 5%, 2.5%, 1%
    logistic:     25%, 10%, 5%, 2.5%, 1%, 0.5%

    If A2 is larger than these critical values then for that significance
    level, the hypothesis that the data come from a normal (exponential)
    can be rejected.
    """
    if not dist in ['norm','expon','gumbel','extreme1','logistic']:
        raise ValueError, "Invalid distribution."
    y = sort(x)
    xbar = stats.mean(x)
    N = len(y)
    if dist == 'norm':
        s = stats.std(x)
        w = (y-xbar)/s
        z = distributions.norm.cdf(w)
        sig = array([15,10,5,2.5,1])
        critical = around(_Avals_norm / (1.0 + 4.0/N - 25.0/N/N),3)
    elif dist == 'expon':
        w = y / xbar
        z = distributions.expon.cdf(w)
        sig = array([15,10,5,2.5,1])
        critical = around(_Avals_expon / (1.0 + 0.6/N),3)
    elif dist == 'logistic':
        def rootfunc(ab,xj,N):
            a,b = ab
            tmp = (xj-a)/b
            tmp2 = exp(tmp)
            val = [sum(1.0/(1+tmp2),axis=0)-0.5*N,
                   sum(tmp*(1.0-tmp2)/(1+tmp2),axis=0)+N]
            return array(val)
        sol0=array([xbar,stats.std(x)])
        sol = optimize.fsolve(rootfunc,sol0,args=(x,N),xtol=1e-5)
        w = (y-sol[0])/sol[1]
        z = distributions.logistic.cdf(w)
        sig = array([25,10,5,2.5,1,0.5])
        critical = around(_Avals_logistic / (1.0+0.25/N),3)
    else:
        def fixedsolve(th,xj,N):
            val = stats.sum(xj)*1.0/N
            tmp = exp(-xj/th)
            term = sum(xj*tmp,axis=0)
            term /= sum(tmp,axis=0)
            return val - term
        s = optimize.fixed_point(fixedsolve, 1.0, args=(x,N),xtol=1e-5)
        xbar = -s*log(sum(exp(-x/s),axis=0)*1.0/N)
        w = (y-xbar)/s
        z = distributions.gumbel_l.cdf(w)
        sig = array([25,10,5,2.5,1])
        critical = around(_Avals_gumbel / (1.0 + 0.2/sqrt(N)),3)
    i = arange(1,N+1)
    S = sum((2*i-1.0)/N*(log(z)+log(1-z[::-1])),axis=0)
    A2 = -N-S
    return A2, critical, sig
开发者ID:mbentz80,项目名称:jzigbeercp,代码行数:64,代码来源:morestats.py

示例14: test_std4

def test_std4():
	obs = std([1.0, 3.0])
	exp = 1.0
开发者ID:KrisHansen,项目名称:simplestats,代码行数:3,代码来源:test_stats.py

示例15: test_std42

def test_std42():
    obs = std([1, 3, -5, 3, -10])
    assert_greater(obs,0)
开发者ID:thchurchill,项目名称:simplestats,代码行数:3,代码来源:test_stats.py


注:本文中的stats.std函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。