topo.sheet

Module

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.

class topo.sheet.Sheet(**params)

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.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param NumericTuple layout_location (constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
activate()

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.

activity_len()

Return the number of items that have been saved by state_push().

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

n_bytes()

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.

override_plasticity_state(new_plasticity_state)

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.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

restore_plasticity_state()

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.

row_col_sheetcoords()

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.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

state_pop()

Pop the most recently saved state off the stack.

See state_push() for more details.

state_push()

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.

class topo.sheet.SettlingCFSheet(**params)[source]

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.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Boolean continuous_learning (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to modify the weights after every settling step. If false, waits until settling is completed before doing learning.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.6, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param Integer mask_init_time (allow_None=False, bounds=(0, None), constant=False, default=5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Determines when a new mask is initialized in each new iteration. The mask is reset whenever new input comes in. Once the activation_count (see tsettle) reaches mask_init_time, the mask is initialized to reflect the current activity profile.
param BoundingRegionParameter nominal_bounds (constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (constant=False, default=<SheetMask SheetMask00042>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Boolean measure_maps (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to include this Sheet when measuring various maps to create SheetViews.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param HookList beginning_of_iteration (bounds=(0, None), constant=False, default=[], instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
List of callables to be executed at the beginning of each iteration.
param Integer tsettle (allow_None=False, bounds=(0, None), constant=False, default=8, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Number of times to activate the SettlingCFSheet sheet for each external input event. A counter is incremented each time an input is received from any source, and once the counter reaches tsettle, the last activation step is skipped so that there will not be any further recurrent activation. The next external (i.e., afferent or feedback) event will then start the counter over again.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param HookList post_initialization_weights_output_fns (bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
If not empty, weights output_fns that will replace the existing ones after an initial normalization step.
param HookList end_of_iteration (bounds=(0, None), constant=False, default=[], instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
List of callables to be executed at the end of each iteration.
param NumericTuple layout_location (constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Callable joint_norm_fn (constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Function to use to compute the norm_total for each CF in each projection from a group to be normalized jointly.
param Parameter strict_tsettle (constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If non-None, delay sending output until activation_count reaches this value.
process_current_time()[source]

Pass the accumulated stimulation through self.output_fns and send it out on the default output port.

send_output(src_port=None, data=None)[source]

Send some data out to all connections on the given src_port.

class topo.sheet.CFSheet(**params)

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.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (constant=False, default=<SheetMask SheetMask00042>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Boolean measure_maps (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to include this Sheet when measuring various maps to create SheetViews.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param NumericTuple layout_location (constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
update_unit_view(x, y, proj_name='')

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.

class topo.sheet.GeneratorSheet(**params)

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.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Number period (allow_None=False, bounds=(0, None), constant=True, default=1, inclusive_bounds=(False, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay (in Simulation time) between generating new input patterns.
param Number phase (allow_None=False, bounds=None, constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay after the start of the Simulation (at time zero) before generating an input pattern. For a clocked, feedforward simulation, one would typically want to use a small nonzero phase and use delays less than the user-visible step size (typically 1.0), so that inputs are generated and processed before this step is complete.
param NumericTuple layout_location (constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param ClassSelector input_generator (allow_None=False, constant=False, default=<Constant Constant00059>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Specifies a particular PatternGenerator type to use when creating patterns.
generate()

Generate the output and send it out the Activity port.

pop_input_generator()

Discard the current input_generator, and retrieve the previous one from the stack.

Warns if no input_generator is available on the stack.

push_input_generator()

Push the current input_generator onto a stack for future retrieval.

set_input_generator(new_ig, push_existing=False)

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.

class topo.sheet.ProjectionSheet(**params)

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.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (constant=False, default=<SheetMask SheetMask00042>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param NumericTuple layout_location (constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
activate()

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.

input_event(conn, data)

Accept input from some sheet. Call .present_input() to compute the stimulation from that sheet.

learn()

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.

n_bytes()

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.

n_conns()

Count the total size of all incoming projections, in number of connections.

override_plasticity_state(new_plasticity_state)

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().

present_input(input_activity, conn)

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.

process_current_time()

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.

projections(name=None)

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.

class topo.sheet.SequenceGeneratorSheet(**params)[source]

Bases: topo.base.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.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Number period (allow_None=False, bounds=(0, None), constant=True, default=1, inclusive_bounds=(False, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay (in Simulation time) between generating new input patterns.
param Number phase (allow_None=False, bounds=None, constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay after the start of the Simulation (at time zero) before generating an input pattern. For a clocked, feedforward simulation, one would typically want to use a small nonzero phase and use delays less than the user-visible step size (typically 1.0), so that inputs are generated and processed before this step is complete.
param List input_sequence (bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
The sequence of patterns to generate. Must be a list of (onset,generator) tuples. An empty list defaults to the single tuple: (0,self.input_generator), resulting in identical behavior to an ordinary GeneratorSheet.
param NumericTuple layout_location (constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param ClassSelector input_generator (allow_None=False, constant=False, default=<Constant Constant00059>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Specifies a particular PatternGenerator type to use when creating patterns.
class topo.sheet.JointNormalizingCFSheet(**params)[source]

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.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (constant=False, default=<SheetMask SheetMask00042>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Boolean measure_maps (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to include this Sheet when measuring various maps to create SheetViews.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param NumericTuple layout_location (constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Callable joint_norm_fn (constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Function to use to compute the norm_total for each CF in each projection from a group to be normalized jointly.
static joint_norm_fn(projlist, active_units_mask=True)

Compute norm_total for each CF in each projection from a group to be normalized jointly.

learn()[source]

Call the learn() method on every Projection to the Sheet, and call the output functions (jointly if necessary).

class topo.sheet.ActivityCopy(**params)[source]

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.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param NumericTuple layout_location (constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
class topo.sheet.JointNormalizingCFSheet_Continuous(**params)[source]

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.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (constant=False, default=<SheetMask SheetMask00042>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Boolean measure_maps (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to include this Sheet when measuring various maps to create SheetViews.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param NumericTuple layout_location (constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Callable joint_norm_fn (constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Function to use to compute the norm_total for each CF in each projection from a group to be normalized jointly.
topo.sheet.compute_joint_norm_totals(projlist, active_units_mask=True)[source]

Compute norm_total for each CF in each projection from a group to be normalized jointly.

class topo.sheet.BoundingBox(**args)

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).

contains(x, y)

Returns true if the given point is contained within the bounding box, where all boundaries of the box are considered to be inclusive.

contains_exclusive(x, y)

Return True if the given point is contained within the bounding box, where the bottom and right boundaries are considered exclusive.

containsbb_exclusive(x)

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.

containsbb_inclusive(x)

Returns true if the given BoundingBox x is contained within the bounding box, including cases of exact match.

lbrt()

return left,bottom,right,top values for the BoundingBox.

upperexclusive_contains(x, y)

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.

topo.sheet.activity_type

alias of float64

Table Of Contents

This Page