comparison python/utils.py @ 854:33d296984dd8

rework and more info on speed probabilities for classification
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 22 Sep 2016 17:50:35 -0400
parents 36c5bee9a887
children 2277ab1a8141
comparison
equal deleted inserted replaced
853:95e7622b11be 854:33d296984dd8
37 # Simple statistics 37 # Simple statistics
38 ######################### 38 #########################
39 39
40 def logNormalMeanVar(loc, scale): 40 def logNormalMeanVar(loc, scale):
41 '''location and scale are respectively the mean and standard deviation of the normal in the log-normal distribution 41 '''location and scale are respectively the mean and standard deviation of the normal in the log-normal distribution
42 https://en.wikipedia.org/wiki/Log-normal_distribution''' 42 https://en.wikipedia.org/wiki/Log-normal_distribution
43
44 same as lognorm.stats(scale, 0, exp(loc))'''
43 mean = exp(loc+(scale**2)/2) 45 mean = exp(loc+(scale**2)/2)
44 var = (exp(loc**2)-1)*exp(2*loc+scale**2) 46 var = (exp(scale**2)-1)*exp(2*loc+scale**2)
45 return mean, var 47 return mean, var
46 48
47 def sampleSize(stdev, tolerance, percentConfidence, printLatex = False): 49 def sampleSize(stdev, tolerance, percentConfidence, printLatex = False):
48 from scipy.stats.distributions import norm 50 from scipy.stats.distributions import norm
49 k = round(norm.ppf(0.5+percentConfidence/200., 0, 1)*100)/100. # 1.-(100-percentConfidence)/200. 51 k = round(norm.ppf(0.5+percentConfidence/200., 0, 1)*100)/100. # 1.-(100-percentConfidence)/200.