11.8 Environment Generation Functions

The following functions are available on the Environment object (in the Generate menu) for algorithmically creating events. See `demo/bp_misc/gen_rnd_prototypes.css' for a CSS script that creates prototypes and random exemplars based on these prototypes using some of the following functions.

ReplicateEvents(int n_replicas, bool make_groups)
This will create n_replicas of all of the existing events in the environment. If make_groups is set, then all events which are replicas of a given one will be placed into the same sub-group. Otherwise, the replicas appear right after the event they are replicas of. This can be used to replicate a set of prototype events, and noise can be added (AddNoise, FlipBits) to create random distortions of these prototypes.
PermutedBinary(int pat_no, int n_on)
This produces random (permuted) binary patterns of 1's and 0's over the existing events in the environment. pat_no determines which pattern to use, and n_on specifies the number of 1's in each random pattern.
PermutedBinary_MinDist(int pat_no, int n_on, float dist, bool max_correl)
This is like PermutedBinary, but it ensures that the hamming distance between any two patterns is at least dist (i.e., all patterns are separated by at least this minimum distance). If max_correl is set, this ensures that the maximum correlation between patterns is below the dist value.
FlipBits(int pat_no, int n_off, int n_on)
This switches exactly n_off values of a pattern from 1 to 0, and n_on from 0 to 1. In other words, some values that were 1 will now be 0, and some values that were 0 will now be 1. This is a useful way of creating random distortions of prototypical patterns.
FlipBits_MinMax(int pat_no, int n_off, int n_on, float min_dist, float max_dist, metric, norm, tol)
This does FlipBits, but if the new event that was just flipped is outside the distance limits set by min_ and max_dist, according to the metric supplied, then another pattern is tried. There is a timeout and an error message will be reported if it takes too many retries to fit these criteria.
AddNoise(int pat_no, Random rnd_spec)
This will add noise of the given specification to all events in pattern pat_no.
TransformPats(int pat_no, PreProcessVals trans)
This will apply given transformation (simple math) operation to all events in pattern pat_no.
DistMatrix(ostream& strm, int pat_no, metric, norm, tol, format, precision)
This produces a distance matrix between all events for given pattern to a file specified by strm. The metric and associated parameters determine how distance is computed. Norm is whether to normalize entire distance, and tol is a unit-wise tolerance, below which dist = 0. The output format can be varied according to the format and precision parameters.
DistMatrixGrid(GridLog* disp_log, metric, norm, tol)
This produces a distance matrix between all events for given pattern, and sends it to the given GridLog for immediate display (if NULL, a new GridLog is created).
CmpDistMatrix(ostream& strm, int pat_no, Environment* cmp_env, int cmp_pat_no, metric, norm, tol, format)
This produces a distance matrix between all events across two different environments, for given pattern on each.
ClusterPlot(GraphLog* disp_log, int pat_no, bool graphic, metric, norm, tol)
This produces a cluster plot of the distance matrix between all events for given pattern, and sends it to the given GraphLog for immediate display. The clusterplot recursively groups the most similar items together, and uses the average of the individual cluster element distances to compute the distance to a cluster, instead of computing an average vector for a cluster and using that to compute distances. This makes the algorithm much more computationally intensive, but also produces nicer results.
EnvToGrid(GridLog* disp_log, int pat_no, ev_x, y, pt_x, y)
This dumps the entire set of events worth of a given pattern into a grid log for more efficient viewing and for more control over the display layout. The ev_x, ev_y parameters control the geometry of the events, and the pt_x, pt_y control the geometry of the pattern values within each event.