Sheet classes.
A Sheet is a two-dimensional arrangement of processing units, typically modeling a neural region or a subset of cells in a neural region. Any new Sheet classes added to this directory will automatically become available for any model.
Bases: topo.base.simulation.EventProcessor, imagen.sheetcoords.SheetCoordinateSystem
The generic base class for neural sheets.
See SheetCoordinateSystem for how Sheet represents space, and EventProcessor for how Sheet handles time.
output_fns are functions that take an activity matrix and produce an identically shaped output matrix. The default is having no output_fns.
Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.
Subclasses will need to override this method to whatever it means to calculate activity in that subclass.
Return the number of items that have been saved by state_push().
The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)
Return a lower bound for the memory taken by this sheet, in bytes.
Typically, this number will include the activity array and any similar arrays, plus any other significant data owned (in some sense) by this Sheet. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements.
Subclasses should reimplement this method if they store a significant amount of data other than in the activity array.
Temporarily override plasticity of medium and long term internal state.
This function should be implemented by all subclasses so that it preserves the ability of the Sheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state (if new_plasticity_state=False).
Any operation that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.
By default, simply saves a copy of the plastic flag to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets plastic to new_plasticity_state.
Delete the dictionary entry with key entry ‘view_name’ to save memory.
Restores plasticity of medium and long term internal state after a override_plasticity_state call.
This function should be implemented by all subclasses to remove the effect of the most recent override_plasticity_state call, i.e. to restore plasticity of any type that was overridden.
Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.
Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.
Pop the most recently saved state off the stack.
See state_push() for more details.
Save the current state of this sheet to an internal stack.
This method is used by operations that need to test the response of the sheet without permanently altering its state, e.g. for measuring maps or probing the current behavior non-invasively. By default, only the activity pattern of this sheet is saved, but subclasses should add saving for any additional state that they maintain, or strange bugs are likely to occur. The state can be restored using state_pop().
Note that Sheets that do learning need not save the values of all connection weights, if any, because plasticity can be turned off explicitly. Thus this method is intended only for shorter-term state.
Bases: topo.sheet.JointNormalizingCFSheet
A JointNormalizingCFSheet implementing the idea of settling.
Breaks continuous time up into discrete iterations, each consisting of a series of activations, up to a fixed number of settling steps. Settling is controlled by the tsettle parameter; once that number of settling steps has been reached, an external input is required before the sheet will activate again.
See the LISSOM algorithm (Sirosh and Miikkulainen, Biological Cybernetics 71:66-78, 1994) for one example of its usage.
Bases: topo.base.projection.ProjectionSheet
A ProjectionSheet providing access to the ConnectionFields in its CFProjections.
CFSheet is a Sheet built from units indexed by Sheet coordinates (x,y). Each unit can have one or more ConnectionFields on another Sheet (via this sheet’s CFProjections). Thus CFSheet is a more concrete version of a ProjectionSheet; a ProjectionSheet does not require that there be units or weights of any kind. Unless you need access to the underlying ConnectionFields for visualization or analysis, CFSheet and ProjectionSheet are interchangeable.
Creates the list of UnitView objects for a particular unit in this CFSheet. (There is one UnitView for each Projection to this CFSheet).
Each UnitView is then added to the sheet_views of its source sheet. It returns the list of all UnitViews for the given unit.
Bases: topo.base.sheet.Sheet
Sheet for generating a series of 2D patterns.
Typically generates the patterns by choosing parameters from a random distribution, but can use any mechanism.
Generate the output and send it out the Activity port.
Discard the current input_generator, and retrieve the previous one from the stack.
Warns if no input_generator is available on the stack.
Push the current input_generator onto a stack for future retrieval.
Set the input_generator, overwriting the existing one by default.
If push_existing is false, the existing input_generator is discarded permanently. Otherwise, the existing one is put onto a stack, and can later be restored by calling pop_input_generator.
Bases: topo.base.sheet.Sheet
A Sheet whose activity is computed using Projections from other sheets.
A standard ProjectionSheet expects its input to be generated from other Sheets. Upon receiving an input event, the ProjectionSheet interprets the event data to be (a copy of) an activity matrix from another sheet. The ProjectionSheet provides a copy of this matrix to each Projection from that input Sheet, asking each one to compute their own activity in response. The same occurs for any other pending input events.
After all events have been processed for a given time, the ProjectionSheet computes its own activity matrix using its activate() method, which by default sums all its Projections’ activity matrices and passes the result through user-specified output_fns() before sending it out on the default output port. The activate() method can be overridden to sum some of the projections, multiply that by the sum of other projections, etc., to model modulatory or other more complicated types of connections.
Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.
Subclasses may override this method to whatever it means to calculate activity in that subclass.
Accept input from some sheet. Call .present_input() to compute the stimulation from that sheet.
By default, call the learn() and apply_learn_output_fns() methods on every Projection to this Sheet.
Any other type of learning can be implemented by overriding this method. Called from self.process_current_time() _after_ activity has been propagated.
Estimate the memory bytes taken by this Sheet and its Projections.
Typically, this number will include the activity array and any similar arrays, plus memory taken by all incoming Projections. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements. Thus this value should be considered only a rough lower bound from which memory requirements and memory usage patterns can be estimated.
Subclasses should reimplement this method if they store a significant amount of data other than in the activity array and the projections.
Count the total size of all incoming projections, in number of connections.
Temporarily override plasticity state of medium and long term internal state.
This function should be implemented by all subclasses so that when new_plasticity_state=False, it preserves the ability of the ProjectionSheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.
Any process that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.
By default, calls override_plasticity_state() on the ProjectionSheet’s output_fns and all of its incoming Projections, and also enables the ‘plastic’ parameter for this ProjectionSheet. The old value of the plastic parameter is saved to an internal stack to be restored by restore_plasticity_state().
Provide the given input_activity to each in_projection that has a dest_port equal to the specified port, asking each one to compute its activity.
The sheet’s own activity is not calculated until activate() is called.
Called by the simulation after all the events are processed for the current time but before time advances. Allows the event processor to send any events that must be sent before time advances to drive the simulation.
Return either a named input p, or a dictionary {projection_name, projection} of all the in_connections for this ProjectionSheet.
A minor convenience function for finding projections by name; the sheet’s list of in_connections usually provides simpler access to the Projections.
Bases: topo.misc.generatorsheet.GeneratorSheet
Sheet that generates a timed sequence of patterns.
This sheet will repeatedly generate the input_sequence, with the given onsets. The sequence is repeated every self.period time units. If the total length of the sequence is longer than self.period, a warning is issued and the sequence repeats immediately after completion.
Bases: topo.base.cf.CFSheet
A type of CFSheet extended to support joint sum-based normalization.
For L1 normalization, joint normalization means normalizing the sum of (the absolute values of) all weights in a set of corresponding CFs in different Projections, rather than only considering weights in the same CF.
This class provides a mechanism for grouping Projections (see _port_match and _grouped_in_projections) and a learn() function that computes the joint sums. Joint normalization also requires having ConnectionField store and return a norm_total for each neuron, and having an TransferFn that will respect this norm_total rather than the strict total of the ConnectionField’s weights. At present, CFPOF_DivisiveNormalizeL1 and CFPOF_DivisiveNormalizeL1_opt do use norm_total; others can be extended to do something similar if necessary.
To enable joint normalization, you can declare that all the incoming connections that should be normalized together each have a dest_port of:
dest_port=(‘Activity’,’JointNormalize’, ‘AfferentGroup1’),
Then all those that have this dest_port will be normalized together, as long as an appropriate TransferFn is being used.
Compute norm_total for each CF in each projection from a group to be normalized jointly.
Bases: topo.base.sheet.Sheet
Copies incoming Activity patterns to its activity matrix and output port.
Trivial Sheet class that is useful primarily as a placeholder for data that is computed elsewhere but that you want to appear as a Sheet, e.g. when wrapping an external simulation.
Bases: topo.sheet.JointNormalizingCFSheet
CFSheet that runs continuously, with no ‘resting’ periods between pattern presentations.
Note that learning occurs only when the time is a whole number.
Compute norm_total for each CF in each projection from a group to be normalized jointly.
Bases: imagen.boundingregion.BoundingRegion
A rectangular bounding box defined either by two points forming an axis-aligned rectangle (or simply a radius for a square).
Returns true if the given point is contained within the bounding box, where all boundaries of the box are considered to be inclusive.
Return True if the given point is contained within the bounding box, where the bottom and right boundaries are considered exclusive.
Returns true if the given BoundingBox x is contained within the bounding box, where at least one of the boundaries of the box has to be exclusive.
Returns true if the given BoundingBox x is contained within the bounding box, including cases of exact match.
return left,bottom,right,top values for the BoundingBox.
Returns true if the given point is contained within the bounding box, where the right and upper boundaries are exclusive, and the left and lower boundaries are inclusive. Useful for tiling a plane into non-overlapping regions.
alias of float64