Mercurial Hosting > traffic-intelligence
changeset 687:de278c5e65f6 dev
minor comments for lognormal parameters (numpy and usual names differ)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 22 Jun 2015 15:27:33 +0200 |
parents | cdee6a3a47b4 |
children | f2b52355a286 |
files | python/utils.py scripts/classify-objects.py |
diffstat | 2 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/python/utils.py Tue Jun 09 17:29:03 2015 +0200 +++ b/python/utils.py Mon Jun 22 15:27:33 2015 +0200 @@ -27,6 +27,8 @@ ######################### def logNormalMeanVar(loc, scale): + '''location and scale are respectively the mean and standard deviation of the normal in the log-normal distribution + https://en.wikipedia.org/wiki/Log-normal_distribution''' mean = exp(loc+(scale**2)/2) var = (exp(loc**2)-1)*exp(2*loc+scale**2) return mean, var
--- a/scripts/classify-objects.py Tue Jun 09 17:29:03 2015 +0200 +++ b/scripts/classify-objects.py Mon Jun 22 15:27:33 2015 +0200 @@ -52,7 +52,7 @@ # log logistic for ped and bik otherwise ((pedBeta/pedAlfa)*((sMean/pedAlfa)**(pedBeta-1)))/((1+(sMean/pedAlfa)**pedBeta)**2.) speedProbabilities = {'car': lambda s: norm(params.meanVehicleSpeed, params.stdVehicleSpeed).pdf(s), 'pedestrian': lambda s: norm(params.meanPedestrianSpeed, params.stdPedestrianSpeed).pdf(s), - 'bicycle': lambda s: lognorm(params.scaleCyclistSpeed, loc = 0., scale = np.exp(params.locationCyclistSpeed)).pdf(s)} # lognorm shape, loc, scale + 'bicycle': lambda s: lognorm(params.scaleCyclistSpeed, loc = 0., scale = np.exp(params.locationCyclistSpeed)).pdf(s)} # numpy lognorm shape, loc, scale: shape for numpy is scale (std of the normal) and scale for numpy is location (mean of the normal) if args.plotSpeedDistribution: import matplotlib.pyplot as plt