Package gmisclib :: Module mcmc_indexclass
[frames] | no frames]

Module mcmc_indexclass

source code

This module provides several classes to manage the parameters of an algorithm, particularly so that you can run the optimizer on it. Essentially, the main problem that it solves is how to keep track of human-readable names assigned to components of a vector of parameters.

You have an index_base object i, and out can get a parameter from it like this: i.p("velocity", "car", "x"). That would get out a number that might correspond to the x-velocity of a car. That's the human-readable side, but you can also get a vector of all the parameters via i.get_prms() and get a mapping between names and indices into that vector via

You can also have parameters that do not appear in the vector of adjustable parameters. These are known as "fixed" parameters; their intent is to let you fix some of the parameters of an optimization, and let the optimizer play with the remainder.

Use guess first to establish the mapping, write it to a file and guess reasonable starting values for an optimization. Then, use index to get parameter values corresponding to names.

This is a map from a regular expression to a callable object.
This is a special-purpose wrapped version of index.
default_mapfp(nmprefix='m') source code
guess_to_indexer(g) source code
reindex(q, ref)
This remaps the parameters of q so that they are in the same order as in ref.
source code
  Debug = False
  __package__ = 'gmisclib'

Imports: re, os, numpy, die, dictops, g_encode

Function Details

reindex(q, ref)

source code 

This remaps the parameters of q so that they are in the same order as in ref.

Returns: indexer
an indexer that contains the same data as q, but shares its parameter mapping with ref.

Note: The parameters in q must be a superset of the adjustable parameters in ref. Extra parameters in q will be carried over as fixed parameters.