Created on Oct 22, 2013
@author: J.Akeret
cosmoHammer.pso.BestFitPositionGenerator.
BestFitPositionGenerator
(mpi=False, threads=1, particleCount=None, maxIter=None)[source]¶Bases: object
A position generator which uses a particle swarm optimization algorithm to find the best fit value and the collapsed swarm to estimate the curvature matrix at that point. The optimization process can be parallelized over MPI and python multiprocessing.
Parameters: |
|
---|
BEST_FILE_NAME
= '_best_fit_global.out'¶BEST_INFO_FILE_NAME
= '_best_fit_info.out'¶MAX_PSO_ITER
= 1000¶MIN_PARTICLE_COUNT
= 20¶generate
()[source]¶generates the positions by running the PSO and using the chain’s min and max and then calling the paraboloid fitter in order to estimate the covariance matrix. The position will then be generated by drawing position from a multivariant gaussian distribution defined by the best fit and the estimated covariance matrix. The progress of the PSO is successively stored to a the disk.
Created on Oct 30, 2013
@author: J.Akeret
cosmoHammer.pso.CurvatureFitter.
CurvatureFitter
(swarm, gbest)[source]¶Bases: object
Fits a paraboloid centered around the global best fit of the PSO by estimating a curvarture matrix with the particle given in the swarm
Parameters: |
|
---|
cosmoHammer.pso.CurvatureFitter.
errfunc
(p, theta, delta, thetabar)[source]¶Error function defined by f(theta) - delta :param p: list of samples :param theta: the curvature matrix. see parabola def :param delta: the measured values
cosmoHammer.pso.CurvatureFitter.
errfunc2
(p, theta, delta, thetabar)[source]¶Error function defined by f(theta) - delta :param p: the curvature matrix. see parabola def :param theta: list of samples :param delta: the measured values
cosmoHammer.pso.CurvatureFitter.
parabola
(p, theta, thetabar=1)[source]¶Computation of the paraboloid for the given curvature matrix and samples. :param p: list of samples :param theta: vector containing the lower triangle of the matrix and the offset from the true mean
Returns: | vector y from f(x,p) |
---|
Created on Oct 28, 2013
@author: J.Akeret
cosmoHammer.pso.MpiParticleSwarmOptimizer.
MpiParticleSwarmOptimizer
(func, low, high, particleCount=25, threads=1)[source]¶Bases: cosmoHammer.pso.ParticleSwarmOptimizer.ParticleSwarmOptimizer
PSO with support for MPI to distribute the workload over multiple nodes
Created on Sep 30, 2013
@author: J. Akeret
cosmoHammer.pso.ParticleSwarmOptimizer.
Particle
(position, velocity, fitness=0)[source]¶Bases: object
Implementation of a single particle
Parameters: |
|
---|
cosmoHammer.pso.ParticleSwarmOptimizer.
ParticleSwarmOptimizer
(func, low, high, particleCount=25, threads=1, pool=None)[source]¶Bases: object
Optimizer using a swarm of particles
Parameters: |
|
---|
optimize
(maxIter=1000, c1=1.193, c2=1.193, p=0.7, m=0.001, n=0.01)[source]¶Runs the complete optimiziation.
Parameters: |
|
---|---|
Return swarms, gBests: | |
the swarms and the global bests of all iterations |
sample
(maxIter=1000, c1=1.193, c2=1.193, p=0.7, m=0.001, n=0.01)[source]¶Launches the PSO. Yields the complete swarm per iteration
Parameters: |
|
---|