博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python二分法查找程序_Python程序查找标准偏差
阅读量:2537 次
发布时间:2019-05-11

本文共 1853 字,大约阅读时间需要 6 分钟。

python二分法查找程序

While dealing with a large data, how many samples do we need to look at before we can have justified confidence in our answer? This depends on the variance of the dataset.

在处理大量数据时,我们需要先查看多少样本,才能对我们的答案有充分的把握? 这取决于数据集的方差。

Variance tells us about the divergence and the inconsistency of the sample. The standard deviation of a collection of values is the square root of the variance. While it contains the same information as the variance. But Standard deviation is quite more referred. Why? Look at the below statement:

方差告诉我们样本的差异和不一致。 值集合的标准偏差是方差的平方根。 虽然它包含与方差相同的信息。 但是标准偏差要多得多。 为什么? 看下面的语句:

The mean income of the population is 846000 with a standard deviation of 4000.

The mean income of the population is 846000 with a variance of 16000000.

人口的平均收入是846000, 标准差是4000。

人口的平均收入是846000,方差16000000。

Now see which statement is more favorable and therefore we use standard deviation.

现在看看哪种说法更有利,因此我们使用标准差。

So in this python article, we are going to build a function for finding the SD.

因此,在这篇Python文章中,我们将构建一个用于查找SD的函数。

So the following function can be used while working on a program with big data which is very useful and help you a lot.

因此,在处理具有大数据的程序时可以使用以下功能,这非常有用,对您有很大帮助。

So here is the function code:

所以这是功能代码:

def stdv(X):    mean = sum(X)/len(X)    tot = 0.0    for x in X:        tot = tot + (x - mean)**2    return (tot/len(X))**0.5# main code#  a simple data-set sample = [1, 2, 3, 4, 5] print("Standard Deviation of the sample is: ", stdv(sample))sample = [1, 2, 3, -4, -5] print("Standard Deviation of the sample is: ", stdv(sample))sample = [10, -20, 30, -40, 50] print("Standard Deviation of the sample is: ", stdv(sample))

Output:

输出:

Standard Deviation of the sample is:  1.4142135623730951 Standard Deviation of the sample is:  3.2619012860600183 Standard Deviation of the sample is:  32.61901286060018

翻译自:

python二分法查找程序

转载地址:http://tcvzd.baihongyu.com/

你可能感兴趣的文章
shell——按指定列排序
查看>>
crash 收集
查看>>
507 LOJ 「LibreOJ NOI Round #1」接竹竿
查看>>
UI基础--烟花动画
查看>>
2018. 2.4 Java中集合嵌套集合的练习
查看>>
精通ASP.NET Web程序测试
查看>>
vue 根据不同属性 设置背景
查看>>
51Nod1601 完全图的最小生成树计数 Trie Prufer编码
查看>>
Codeforces 1110D. Jongmah 动态规划
查看>>
android驱动在win10系统上安装的心酸历程
查看>>
优雅的程序员
查看>>
oracle之三 自动任务调度
查看>>
Android dex分包方案
查看>>
ThreadLocal为什么要用WeakReference
查看>>
删除本地文件
查看>>
FOC实现概述
查看>>
base64编码的图片字节流存入html页面中的显示
查看>>
这个大学时代的博客不在维护了,请移步到我的新博客
查看>>
GUI学习之二十一——QSlider、QScroll、QDial学习总结
查看>>
nginx反向代理docker registry报”blob upload unknown"解决办法
查看>>