topo.projection Package


projection Package

Inheritance diagram of topo.projection

Projection classes.

A Projection is a connection between two Sheets, generally implemented as a large set of ConnectionFields.

Any new Projection classes added to this directory will automatically become available for any model.

class topo.projection.OneToOneProjection(**kw)[source]

Bases: topo.base.projection.Projection

A projection that has at most one input connection for each unit.

This projection has exactly one weight for each destination unit. The input locations on the input sheet are determined by a coordinate mapper. Inputs that map outside the bounds of the input sheet are treated as having zero weight.

param Number learning_rate (allow_None=False, bounds=None, constant=False, default=0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)

param Parameter src (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.1, readonly=False)
The EventProcessor from which messages originate.

param Number strength (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)

param Parameter src_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False)
Identifier that can be used to distinguish different types of outgoing connections. EventProcessors that generate only a single type of outgoing event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for src_port. It is up to the src EventProcessor to deliver appropriate data to each port, and to declare what will be sent over that port.

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

param Parameter dest (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.11, readonly=False)
The EventProcessor to which messages are delivered.
param ClassSelector coord_mapper (allow_None=False, constant=False, default=<IdentityMF IdentityMF01508>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function to map a destination unit coordinate into the src sheet.
param HookList input_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the input before the projection activity is computed.
param Boolean private (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Set to true if this connection is for internal use only, not to be manipulated by a user.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to update the internal state on each call. Allows plasticity to be turned off during analysis, and then re-enabled.
param Number delay (allow_None=False, bounds=(0, 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>)
Simulation time between generation of an Event by the src and delivery to the dest. Should normally be nonzero, to represent a causal with a well-defined ordering of events.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the projection activity after it is computed.
param ClassSelector weights_generator (allow_None=False, constant=True, default=<Constant Constant01509>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Generate initial weight values for each unit of the destination sheet.
param Parameter activity_group (allow_None=False, constant=False, default=(0.5, <ufunc ‘add’>), instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Grouping and precedence specifier for computing activity from Projections. In a ProjectionSheet, all Projections in the same activity_group will be summed, and then the results from each group will be combined in the order of the activity_group using the operator specified by the activity_operator. For instance, if there are two Projections with activity_group==(0.2,numpy.add) and two with activity_group==(0.6,numpy.divide), activity from the first two will be added together, and the result divided by the sum of the second two.
param ClassSelector learning_fn (allow_None=False, constant=False, default=<IdentityLF IdentityLF01510>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Learning function applied to weights.
param Parameter dest_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False)
Identifier that can be used to distinguish different types of incoming connections. EventProcessors that accept only a single type of incoming event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for dest_port. It is up to the dest EventProcessor to process the data appropriately for each port, and to define what is expected to be sent to that port.
apply_learn_output_fns(active_units_mask=True)

Sub-classes can implement this function if they wish to perform an operation after learning has completed, such as normalizing weight values across different projections.

The active_units_mask argument determines whether or not to apply the output_fn to non-responding units.

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2b07af984730>
get_param_values(onlychanged=False)

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object at 0x2b07af984a48>
inspect_value = <functools.partial object at 0x2b07af984aa0>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

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 Projection to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

For instance, if new_plasticity_state is False, in a Projection with modifiable connection weights, the values of those weights should temporarily be made fixed and unchanging after this call. For a Projection with automatic normalization, homeostatic plasticity, or other features that depend on a history of events (rather than just the current item being processed), changes in those properties would be disabled temporarily. Setting the plasticity state to False is useful during analysis operations (e.g. map measurement) that would otherwise change the state of the underlying network.

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, this call simply calls override_plasticity_state() on the Projection’s output_fn, and sets the ‘plastic’ parameter to False.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

projection_view(timestamp=None)

Returns the activity in a single projection

remove()

Remove this connection from its src’s list of out_connections and its dest’s list of in_connections.

restore_plasticity_state()

Restore previous plasticity state 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, e.g. to reenable plasticity of any type that was disabled.

script_repr(imports=, []prefix=' ')

Generate a runnable command for creating this connection.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2b07af984af8>
set_param = <functools.partial object at 0x2b07af984998>
state_pop()

Pop the most recently pushed activity state of the stack.

state_push()

Push the current activity state onto the stack.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class topo.projection.Projection(**params)

Bases: topo.base.simulation.EPConnection

A projection from a Sheet into a ProjectionSheet.

Projections are required to support the activate() method, which will construct a matrix the same size as the target ProjectionSheet, from an input matrix of activity from the source Sheet. Other than that, a Projection may be of any type.

param Parameter src (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.1, readonly=False)
The EventProcessor from which messages originate.

param Number strength (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)

param Parameter src_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False)
Identifier that can be used to distinguish different types of outgoing connections. EventProcessors that generate only a single type of outgoing event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for src_port. It is up to the src EventProcessor to deliver appropriate data to each port, and to declare what will be sent over that port.

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

param Parameter dest (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.11, readonly=False)
The EventProcessor to which messages are delivered.
param HookList input_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the input before the projection activity is computed.
param Boolean private (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Set to true if this connection is for internal use only, not to be manipulated by a user.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to update the internal state on each call. Allows plasticity to be turned off during analysis, and then re-enabled.
param Number delay (allow_None=False, bounds=(0, 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>)
Simulation time between generation of an Event by the src and delivery to the dest. Should normally be nonzero, to represent a causal with a well-defined ordering of events.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the projection activity after it is computed.
param Parameter activity_group (allow_None=False, constant=False, default=(0.5, <ufunc ‘add’>), instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Grouping and precedence specifier for computing activity from Projections. In a ProjectionSheet, all Projections in the same activity_group will be summed, and then the results from each group will be combined in the order of the activity_group using the operator specified by the activity_operator. For instance, if there are two Projections with activity_group==(0.2,numpy.add) and two with activity_group==(0.6,numpy.divide), activity from the first two will be added together, and the result divided by the sum of the second two.
param Parameter dest_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False)
Identifier that can be used to distinguish different types of incoming connections. EventProcessors that accept only a single type of incoming event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for dest_port. It is up to the dest EventProcessor to process the data appropriately for each port, and to define what is expected to be sent to that port.
activate(input_activity)

Compute an activity matrix for output, based on the specified input_activity.

Subclasses must override this method to whatever it means to calculate activity in that subclass.

apply_learn_output_fns(active_units_mask=True)

Sub-classes can implement this function if they wish to perform an operation after learning has completed, such as normalizing weight values across different projections.

The active_units_mask argument determines whether or not to apply the output_fn to non-responding units.

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2b07af984730>
get_param_values(onlychanged=False)

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object at 0x2b07af984890>
inspect_value = <functools.partial object at 0x2b07af984838>
learn()

This function has to be re-implemented by sub-classes, if they wish to support learning.

message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

n_bytes()

Estimate the memory bytes taken by this Projection.

By default, counts only the activity array, but subclasses should implement this method to include also the bytes taken by weight arrays and any similar arrays, as a rough lower bound from which memory requirements and memory usage patterns can be estimated.

n_conns()

Return the size of this projection, in number of connections.

Must be implemented by subclasses, if only to declare that no connections are stored.

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 Projection to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

For instance, if new_plasticity_state is False, in a Projection with modifiable connection weights, the values of those weights should temporarily be made fixed and unchanging after this call. For a Projection with automatic normalization, homeostatic plasticity, or other features that depend on a history of events (rather than just the current item being processed), changes in those properties would be disabled temporarily. Setting the plasticity state to False is useful during analysis operations (e.g. map measurement) that would otherwise change the state of the underlying network.

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, this call simply calls override_plasticity_state() on the Projection’s output_fn, and sets the ‘plastic’ parameter to False.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

projection_view(timestamp=None)

Returns the activity in a single projection

remove()

Remove this connection from its src’s list of out_connections and its dest’s list of in_connections.

restore_plasticity_state()

Restore previous plasticity state 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, e.g. to reenable plasticity of any type that was disabled.

script_repr(imports=, []prefix=' ')

Generate a runnable command for creating this connection.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2b07af984ba8>
set_param = <functools.partial object at 0x2b07af9848e8>
state_pop()

Pop the most recently pushed activity state of the stack.

state_push()

Push the current activity state onto the stack.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class topo.projection.SharedWeightCFProjection(**params)[source]

Bases: topo.base.cf.CFProjection

A Projection with a single set of weights, shared by all units.

Otherwise similar to CFProjection, except that learning is currently disabled.

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

param Boolean private (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Set to true if this connection is for internal use only, not to be manipulated by a user.
param Integer seed (allow_None=True, bounds=None, constant=False, default=None, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
The random seed used to determine the randomized weight initialization stream. If not None, equivalent to appending the chosen integer to the hash_format.
param Boolean apply_output_fns_init (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 function to connection fields (e.g. for normalization) when the CFs are first created.
param Parameter dest_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False)
Identifier that can be used to distinguish different types of incoming connections. EventProcessors that accept only a single type of incoming event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for dest_port. It is up to the dest EventProcessor to process the data appropriately for each port, and to define what is expected to be sent to that port.
param Number strength (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Global multiplicative scaling applied to the Activity of this Sheet.
param Parameter src_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False)
Identifier that can be used to distinguish different types of outgoing connections. EventProcessors that generate only a single type of outgoing event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for src_port. It is up to the src EventProcessor to deliver appropriate data to each port, and to declare what will be sent over that port.
param Parameter cf_type (allow_None=False, constant=True, default=<class ‘topo.base.cf.ConnectionField’>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Type of ConnectionField to use when creating individual CFs.
param ClassSelector cf_shape (allow_None=False, constant=True, default=<Constant Constant01282>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Mask pattern to define the shape of the connection fields.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to update the internal state on each call. Allows plasticity to be turned off during analysis, and then re-enabled.
param Number delay (allow_None=False, bounds=(0, 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>)
Simulation time between generation of an Event by the src and delivery to the dest. Should normally be nonzero, to represent a causal with a well-defined ordering of events.
param BoundingRegionParameter nominal_bounds_template (allow_None=False, constant=False, default=BoundingBox(radius=0.1), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Bounds defining the Sheet area covered by a prototypical ConnectionField. The true bounds will differ depending on the density (see create_slice_template()).
param ClassSelector response_fn (allow_None=False, constant=False, default=<CFPRF_Plugin CFPRF_Plugin01279>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function for computing the Projection response to an input pattern.
param Boolean same_cf_shape_for_all_cfs (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to share a single cf_shape mask for all CFs. If True, the cf_shape is evaluated only once and shared for all CFs, which saves computation time and memory. If False, the cf_shape is evaluated once for each CF, allowing each to have its own shape.
param Parameter activity_group (allow_None=False, constant=False, default=(0.5, <ufunc ‘add’>), instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Grouping and precedence specifier for computing activity from Projections. In a ProjectionSheet, all Projections in the same activity_group will be summed, and then the results from each group will be combined in the order of the activity_group using the operator specified by the activity_operator. For instance, if there are two Projections with activity_group==(0.2,numpy.add) and two with activity_group==(0.6,numpy.divide), activity from the first two will be added together, and the result divided by the sum of the second two.
param ClassSelector coord_mapper (allow_None=False, constant=False, default=<IdentityMF IdentityMF01287>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function to map a projected coordinate into the target sheet.
param Number mask_threshold (allow_None=False, bounds=None, constant=True, default=0.5, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
If a unit is above this value in the cf_shape mask, it is included; otherwise it is excluded from the mask.
param Parameter dest (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.11, readonly=False)
The EventProcessor to which messages are delivered.
param Number learning_rate (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Amount of learning at each step for this projection, specified in units that are independent of the density of each Sheet.
param Boolean autosize_mask (allow_None=False, bounds=(0, 1), constant=True, default=True, instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
Topographica sets the mask size so that it is the same as the connection field’s size, unless this parameter is False - in which case the user-specified size of the cf_shape is used. In normal usage of Topographica, this parameter should remain True.
param Boolean allow_null_cfs (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not the projection can have entirely empty CFs
param Integer min_matrix_radius (allow_None=False, bounds=(0, None), constant=False, default=1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Enforced minimum for radius of weights matrix. The default of 1 gives a minimum matrix of 3x3. 0 would allow a 1x1 matrix.
param ClassSelector learning_fn (allow_None=False, constant=True, default=<CFPLF_Identity CFPLF_Identity01504>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function for computing changes to the weights based on one activation step.
param String hash_format (allow_None=False, basestring=<type ‘basestring’>, constant=False, default={name}-{src}-{dest}, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Format string to determine the hash value used to initialize random weight generation. Format keys available include {name} {src} and {dest}.
param Parameter src (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.1, readonly=False)
The EventProcessor from which messages originate.
param ClassSelector weights_generator (allow_None=False, constant=True, default=<Constant Constant01281>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Generate initial weights values.
param HookList weights_output_fns (allow_None=False, bounds=(0, None), constant=False, default=[CFPOF_SharedWeight(name=’CFPOF_SharedWeight01506’, single_cf_fn=IdentityTF(init_keys=[], name=’IdentityTF01507’, norm_value=None))], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Functions applied to each CF after learning.
param HookList input_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the input before the projection activity is computed.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the projection activity after it is computed.
activate(input_activity)

Activate using the specified response_fn and output_fn.

apply_learn_output_fns(active_units_mask=True)[source]

Because of how output functions are applied, it is not currently possible to use learning functions and learning output functions for SharedWeightCFProjections, so we disable them here.

cf(r, c)

Return the specified ConnectionField

cf_bounds(r, c)

Return the bounds of the specified ConnectionField.

cf_type

alias of ConnectionField

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2b07af9848e8>
get_param_values(onlychanged=False)

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object at 0x2b07af9847e0>
inspect_value = <functools.partial object at 0x2b07af984a48>
learn()[source]

Because of how output functions are applied, it is not currently possible to use learning functions and learning output functions for SharedWeightCFProjections, so we disable them here.

message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

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 Projection to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

For instance, if new_plasticity_state is False, in a Projection with modifiable connection weights, the values of those weights should temporarily be made fixed and unchanging after this call. For a Projection with automatic normalization, homeostatic plasticity, or other features that depend on a history of events (rather than just the current item being processed), changes in those properties would be disabled temporarily. Setting the plasticity state to False is useful during analysis operations (e.g. map measurement) that would otherwise change the state of the underlying network.

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, this call simply calls override_plasticity_state() on the Projection’s output_fn, and sets the ‘plastic’ parameter to False.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

projection_view(timestamp=None)

Returns the activity in a single projection

remove()

Remove this connection from its src’s list of out_connections and its dest’s list of in_connections.

restore_plasticity_state()

Restore previous plasticity state 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, e.g. to reenable plasticity of any type that was disabled.

script_repr(imports=, []prefix=' ')

Generate a runnable command for creating this connection.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2b07af984788>
set_param = <functools.partial object at 0x2b07af9849f0>
state_pop()

Pop the most recently pushed activity state of the stack.

state_push()

Push the current activity state onto the stack.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

view(sheet_x, sheet_y, timestamp=None, situated=False, **kwargs)

Return a single connection field Image, for the unit located nearest to sheet coordinate (sheet_x,sheet_y).

warning(msg, *args, **kw)

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class topo.projection.LeakyCFProjection(**params)[source]

Bases: topo.base.cf.ResizableCFProjection

A projection that has a decay_rate parameter so that incoming input is decayed over time as x(t) = input + x(t-1)*exp(-decay_rate), and then the weighted sum of x(t) is calculated.

param Number precedence (allow_None=False, bounds=None, constant=False, default=0.4, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)

param Boolean private (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Set to true if this connection is for internal use only, not to be manipulated by a user.
param Integer seed (allow_None=True, bounds=None, constant=False, default=None, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
The random seed used to determine the randomized weight initialization stream. If not None, equivalent to appending the chosen integer to the hash_format.
param Boolean apply_output_fns_init (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 function to connection fields (e.g. for normalization) when the CFs are first created.
param Parameter dest_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False)
Identifier that can be used to distinguish different types of incoming connections. EventProcessors that accept only a single type of incoming event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for dest_port. It is up to the dest EventProcessor to process the data appropriately for each port, and to define what is expected to be sent to that port.
param Number strength (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Global multiplicative scaling applied to the Activity of this Sheet.
param Parameter src_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False)
Identifier that can be used to distinguish different types of outgoing connections. EventProcessors that generate only a single type of outgoing event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for src_port. It is up to the src EventProcessor to deliver appropriate data to each port, and to declare what will be sent over that port.
param Parameter cf_type (allow_None=False, constant=True, default=<class ‘topo.base.cf.ConnectionField’>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Type of ConnectionField to use when creating individual CFs.
param ClassSelector cf_shape (allow_None=False, constant=True, default=<Constant Constant01282>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Mask pattern to define the shape of the connection fields.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to update the internal state on each call. Allows plasticity to be turned off during analysis, and then re-enabled.
param Number delay (allow_None=False, bounds=(0, 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>)
Simulation time between generation of an Event by the src and delivery to the dest. Should normally be nonzero, to represent a causal with a well-defined ordering of events.
param Number decay_rate (allow_None=False, bounds=(0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Input decay rate for each leaky synapse
param BoundingRegionParameter nominal_bounds_template (allow_None=False, constant=False, default=BoundingBox(radius=0.1), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Bounds defining the Sheet area covered by a prototypical ConnectionField. The true bounds will differ depending on the density (see create_slice_template()).
param ClassSelector response_fn (allow_None=False, constant=False, default=<CFPRF_Plugin CFPRF_Plugin01279>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function for computing the Projection response to an input pattern.
param Boolean same_cf_shape_for_all_cfs (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to share a single cf_shape mask for all CFs. If True, the cf_shape is evaluated only once and shared for all CFs, which saves computation time and memory. If False, the cf_shape is evaluated once for each CF, allowing each to have its own shape.
param Parameter activity_group (allow_None=False, constant=False, default=(0.5, <ufunc ‘add’>), instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Grouping and precedence specifier for computing activity from Projections. In a ProjectionSheet, all Projections in the same activity_group will be summed, and then the results from each group will be combined in the order of the activity_group using the operator specified by the activity_operator. For instance, if there are two Projections with activity_group==(0.2,numpy.add) and two with activity_group==(0.6,numpy.divide), activity from the first two will be added together, and the result divided by the sum of the second two.
param ClassSelector coord_mapper (allow_None=False, constant=False, default=<IdentityMF IdentityMF01287>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function to map a projected coordinate into the target sheet.
param Number mask_threshold (allow_None=False, bounds=None, constant=True, default=0.5, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
If a unit is above this value in the cf_shape mask, it is included; otherwise it is excluded from the mask.
param Parameter dest (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.11, readonly=False)
The EventProcessor to which messages are delivered.
param Number learning_rate (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Amount of learning at each step for this projection, specified in units that are independent of the density of each Sheet.
param Boolean autosize_mask (allow_None=False, bounds=(0, 1), constant=True, default=True, instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
Topographica sets the mask size so that it is the same as the connection field’s size, unless this parameter is False - in which case the user-specified size of the cf_shape is used. In normal usage of Topographica, this parameter should remain True.
param Boolean allow_null_cfs (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not the projection can have entirely empty CFs
param Integer min_matrix_radius (allow_None=False, bounds=(0, None), constant=False, default=1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Enforced minimum for radius of weights matrix. The default of 1 gives a minimum matrix of 3x3. 0 would allow a 1x1 matrix.
param ClassSelector learning_fn (allow_None=False, constant=False, default=<CFPLF_Plugin CFPLF_Plugin01283>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function for computing changes to the weights based on one activation step.
param String hash_format (allow_None=False, basestring=<type ‘basestring’>, constant=False, default={name}-{src}-{dest}, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Format string to determine the hash value used to initialize random weight generation. Format keys available include {name} {src} and {dest}.
param Parameter src (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.1, readonly=False)
The EventProcessor from which messages originate.
param ClassSelector weights_generator (allow_None=False, constant=True, default=<Constant Constant01281>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Generate initial weights values.
param HookList weights_output_fns (allow_None=False, bounds=(0, None), constant=False, default=[CFPOF_Plugin(name=’CFPOF_Plugin01285’, single_cf_fn=IdentityTF(init_keys=[], name=’IdentityTF01286’, norm_value=None))], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Functions applied to each CF after learning.
param HookList input_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the input before the projection activity is computed.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the projection activity after it is computed.
activate(input_activity)[source]

Retain input_activity from the previous step in leaky_input_buffer and add a leaked version of it to the current input_activity. This function needs to deal with a finer time-scale.

apply_learn_output_fns(active_units_mask=True)

Apply the weights_output_fns to each unit.

If active_units_mask is True, inactive units will be skipped.

cf(r, c)

Return the specified ConnectionField

cf_bounds(r, c)

Return the bounds of the specified ConnectionField.

cf_type

alias of ConnectionField

change_bounds(nominal_bounds_template)

Change the bounding box for all of the ConnectionFields in this Projection.

Calls change_bounds() on each ConnectionField.

Currently only allows reducing the size, but should be extended to allow increasing as well.

change_density(new_wt_density)

Rescales the weight matrix in place, interpolating or resampling as needed.

Not yet implemented.

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2b07af984730>
get_param_values(onlychanged=False)

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object at 0x2b07af984940>
inspect_value = <functools.partial object at 0x2b07af984c00>
learn()

For a CFProjection, learn consists of calling the learning_fn.

message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

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 Projection to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

For instance, if new_plasticity_state is False, in a Projection with modifiable connection weights, the values of those weights should temporarily be made fixed and unchanging after this call. For a Projection with automatic normalization, homeostatic plasticity, or other features that depend on a history of events (rather than just the current item being processed), changes in those properties would be disabled temporarily. Setting the plasticity state to False is useful during analysis operations (e.g. map measurement) that would otherwise change the state of the underlying network.

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, this call simply calls override_plasticity_state() on the Projection’s output_fn, and sets the ‘plastic’ parameter to False.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

projection_view(timestamp=None)

Returns the activity in a single projection

remove()

Remove this connection from its src’s list of out_connections and its dest’s list of in_connections.

restore_plasticity_state()

Restore previous plasticity state 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, e.g. to reenable plasticity of any type that was disabled.

script_repr(imports=, []prefix=' ')

Generate a runnable command for creating this connection.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2b07af984aa0>
set_param = <functools.partial object at 0x2b07af984890>
state_pop()

Pop the most recently pushed activity state of the stack.

state_push()

Push the current activity state onto the stack.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

view(sheet_x, sheet_y, timestamp=None, situated=False, **kwargs)

Return a single connection field Image, for the unit located nearest to sheet coordinate (sheet_x,sheet_y).

warning(msg, *args, **kw)

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class topo.projection.ScaledCFProjection(**params)[source]

Bases: topo.base.cf.CFProjection

Allows scaling of activity based on a specified target average activity.

An exponentially weighted average is used to calculate the average activity. This average is then used to calculate scaling factors for the current activity and for the learning rate.

The plastic parameter can be used to turn off updating of the average activity, e.g. during map measurement.

param Number precedence (allow_None=False, bounds=None, constant=False, default=0.4, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)

param Boolean private (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Set to true if this connection is for internal use only, not to be manipulated by a user.
param Number target_lr (allow_None=False, bounds=None, constant=False, default=0.045, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Target average activity for scaling the learning rate.
param Integer seed (allow_None=True, bounds=None, constant=False, default=None, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
The random seed used to determine the randomized weight initialization stream. If not None, equivalent to appending the chosen integer to the hash_format.
param Number smoothing (allow_None=False, bounds=None, constant=False, default=0.999, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Influence of previous activity, relative to current, for computing the average.
param Boolean apply_output_fns_init (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 function to connection fields (e.g. for normalization) when the CFs are first created.
param Parameter dest_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False)
Identifier that can be used to distinguish different types of incoming connections. EventProcessors that accept only a single type of incoming event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for dest_port. It is up to the dest EventProcessor to process the data appropriately for each port, and to define what is expected to be sent to that port.
param Number strength (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Global multiplicative scaling applied to the Activity of this Sheet.
param Parameter src_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False)
Identifier that can be used to distinguish different types of outgoing connections. EventProcessors that generate only a single type of outgoing event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for src_port. It is up to the src EventProcessor to deliver appropriate data to each port, and to declare what will be sent over that port.
param Parameter cf_type (allow_None=False, constant=True, default=<class ‘topo.base.cf.ConnectionField’>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Type of ConnectionField to use when creating individual CFs.
param ClassSelector cf_shape (allow_None=False, constant=True, default=<Constant Constant01282>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Mask pattern to define the shape of the connection fields.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to update the internal state on each call. Allows plasticity to be turned off during analysis, and then re-enabled.
param Number delay (allow_None=False, bounds=(0, 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>)
Simulation time between generation of an Event by the src and delivery to the dest. Should normally be nonzero, to represent a causal with a well-defined ordering of events.
param BoundingRegionParameter nominal_bounds_template (allow_None=False, constant=False, default=BoundingBox(radius=0.1), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Bounds defining the Sheet area covered by a prototypical ConnectionField. The true bounds will differ depending on the density (see create_slice_template()).
param ClassSelector response_fn (allow_None=False, constant=False, default=<CFPRF_Plugin CFPRF_Plugin01279>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function for computing the Projection response to an input pattern.
param Boolean same_cf_shape_for_all_cfs (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to share a single cf_shape mask for all CFs. If True, the cf_shape is evaluated only once and shared for all CFs, which saves computation time and memory. If False, the cf_shape is evaluated once for each CF, allowing each to have its own shape.
param Parameter activity_group (allow_None=False, constant=False, default=(0.5, <ufunc ‘add’>), instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Grouping and precedence specifier for computing activity from Projections. In a ProjectionSheet, all Projections in the same activity_group will be summed, and then the results from each group will be combined in the order of the activity_group using the operator specified by the activity_operator. For instance, if there are two Projections with activity_group==(0.2,numpy.add) and two with activity_group==(0.6,numpy.divide), activity from the first two will be added together, and the result divided by the sum of the second two.
param ClassSelector coord_mapper (allow_None=False, constant=False, default=<IdentityMF IdentityMF01287>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function to map a projected coordinate into the target sheet.
param Number mask_threshold (allow_None=False, bounds=None, constant=True, default=0.5, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
If a unit is above this value in the cf_shape mask, it is included; otherwise it is excluded from the mask.
param Parameter dest (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.11, readonly=False)
The EventProcessor to which messages are delivered.
param Number learning_rate (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Amount of learning at each step for this projection, specified in units that are independent of the density of each Sheet.
param Boolean autosize_mask (allow_None=False, bounds=(0, 1), constant=True, default=True, instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
Topographica sets the mask size so that it is the same as the connection field’s size, unless this parameter is False - in which case the user-specified size of the cf_shape is used. In normal usage of Topographica, this parameter should remain True.
param Boolean allow_null_cfs (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not the projection can have entirely empty CFs
param Integer min_matrix_radius (allow_None=False, bounds=(0, None), constant=False, default=1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Enforced minimum for radius of weights matrix. The default of 1 gives a minimum matrix of 3x3. 0 would allow a 1x1 matrix.
param ClassSelector learning_fn (allow_None=False, constant=False, default=<CFPLF_Plugin CFPLF_Plugin01283>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function for computing changes to the weights based on one activation step.
param String hash_format (allow_None=False, basestring=<type ‘basestring’>, constant=False, default={name}-{src}-{dest}, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Format string to determine the hash value used to initialize random weight generation. Format keys available include {name} {src} and {dest}.
param Parameter src (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.1, readonly=False)
The EventProcessor from which messages originate.
param ClassSelector weights_generator (allow_None=False, constant=True, default=<Constant Constant01281>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Generate initial weights values.
param HookList weights_output_fns (allow_None=False, bounds=(0, None), constant=False, default=[CFPOF_Plugin(name=’CFPOF_Plugin01285’, single_cf_fn=IdentityTF(init_keys=[], name=’IdentityTF01286’, norm_value=None))], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Functions applied to each CF after learning.
param HookList input_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the input before the projection activity is computed.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the projection activity after it is computed.
param Number target (allow_None=False, bounds=None, constant=False, default=0.045, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Target average activity for the projection.
activate(input_activity)[source]

Activate using the specified response_fn and output_fn.

apply_learn_output_fns(active_units_mask=True)

Apply the weights_output_fns to each unit.

If active_units_mask is True, inactive units will be skipped.

calculate_sf()[source]

Calculate current scaling factors based on the target and previous average activities.

Keeps track of the scaled average for debugging. Could be overridden by a subclass to calculate the factors differently.

cf(r, c)

Return the specified ConnectionField

cf_bounds(r, c)

Return the bounds of the specified ConnectionField.

cf_type

alias of ConnectionField

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

do_scaling()[source]

Scale the projection activity and learning rate for the projection.

force_new_dynamic_value = <functools.partial object at 0x2b07af984788>
get_param_values(onlychanged=False)

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object at 0x2b07af984a48>
inspect_value = <functools.partial object at 0x2b07af9848e8>
learn()

For a CFProjection, learn consists of calling the learning_fn.

message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

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 Projection to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

For instance, if new_plasticity_state is False, in a Projection with modifiable connection weights, the values of those weights should temporarily be made fixed and unchanging after this call. For a Projection with automatic normalization, homeostatic plasticity, or other features that depend on a history of events (rather than just the current item being processed), changes in those properties would be disabled temporarily. Setting the plasticity state to False is useful during analysis operations (e.g. map measurement) that would otherwise change the state of the underlying network.

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, this call simply calls override_plasticity_state() on the Projection’s output_fn, and sets the ‘plastic’ parameter to False.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

projection_view(timestamp=None)

Returns the activity in a single projection

remove()

Remove this connection from its src’s list of out_connections and its dest’s list of in_connections.

restore_plasticity_state()

Restore previous plasticity state 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, e.g. to reenable plasticity of any type that was disabled.

script_repr(imports=, []prefix=' ')

Generate a runnable command for creating this connection.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2b07af9849f0>
set_param = <functools.partial object at 0x2b07af984ba8>
state_pop()

Pop the most recently pushed activity state of the stack.

state_push()

Push the current activity state onto the stack.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

view(sheet_x, sheet_y, timestamp=None, situated=False, **kwargs)

Return a single connection field Image, for the unit located nearest to sheet coordinate (sheet_x,sheet_y).

warning(msg, *args, **kw)

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class topo.projection.ResizableCFProjection(initialize_cfs=True, **params)

Bases: topo.base.cf.CFProjection

A CFProjection with resizable weights.

param Number precedence (allow_None=False, bounds=None, constant=False, default=0.8, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)

param Boolean private (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Set to true if this connection is for internal use only, not to be manipulated by a user.
param Integer seed (allow_None=True, bounds=None, constant=False, default=None, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
The random seed used to determine the randomized weight initialization stream. If not None, equivalent to appending the chosen integer to the hash_format.
param Boolean apply_output_fns_init (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 function to connection fields (e.g. for normalization) when the CFs are first created.
param Parameter dest_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False)
Identifier that can be used to distinguish different types of incoming connections. EventProcessors that accept only a single type of incoming event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for dest_port. It is up to the dest EventProcessor to process the data appropriately for each port, and to define what is expected to be sent to that port.
param Number strength (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Global multiplicative scaling applied to the Activity of this Sheet.
param Parameter src_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False)
Identifier that can be used to distinguish different types of outgoing connections. EventProcessors that generate only a single type of outgoing event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for src_port. It is up to the src EventProcessor to deliver appropriate data to each port, and to declare what will be sent over that port.
param Parameter cf_type (allow_None=False, constant=True, default=<class ‘topo.base.cf.ConnectionField’>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Type of ConnectionField to use when creating individual CFs.
param ClassSelector cf_shape (allow_None=False, constant=True, default=<Constant Constant01282>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Mask pattern to define the shape of the connection fields.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to update the internal state on each call. Allows plasticity to be turned off during analysis, and then re-enabled.
param Number delay (allow_None=False, bounds=(0, 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>)
Simulation time between generation of an Event by the src and delivery to the dest. Should normally be nonzero, to represent a causal with a well-defined ordering of events.
param BoundingRegionParameter nominal_bounds_template (allow_None=False, constant=False, default=BoundingBox(radius=0.1), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Bounds defining the Sheet area covered by a prototypical ConnectionField. The true bounds will differ depending on the density (see create_slice_template()).
param ClassSelector response_fn (allow_None=False, constant=False, default=<CFPRF_Plugin CFPRF_Plugin01279>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function for computing the Projection response to an input pattern.
param Boolean same_cf_shape_for_all_cfs (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to share a single cf_shape mask for all CFs. If True, the cf_shape is evaluated only once and shared for all CFs, which saves computation time and memory. If False, the cf_shape is evaluated once for each CF, allowing each to have its own shape.
param Parameter activity_group (allow_None=False, constant=False, default=(0.5, <ufunc ‘add’>), instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Grouping and precedence specifier for computing activity from Projections. In a ProjectionSheet, all Projections in the same activity_group will be summed, and then the results from each group will be combined in the order of the activity_group using the operator specified by the activity_operator. For instance, if there are two Projections with activity_group==(0.2,numpy.add) and two with activity_group==(0.6,numpy.divide), activity from the first two will be added together, and the result divided by the sum of the second two.
param ClassSelector coord_mapper (allow_None=False, constant=False, default=<IdentityMF IdentityMF01287>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function to map a projected coordinate into the target sheet.
param Number mask_threshold (allow_None=False, bounds=None, constant=True, default=0.5, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
If a unit is above this value in the cf_shape mask, it is included; otherwise it is excluded from the mask.
param Parameter dest (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.11, readonly=False)
The EventProcessor to which messages are delivered.
param Number learning_rate (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Amount of learning at each step for this projection, specified in units that are independent of the density of each Sheet.
param Boolean autosize_mask (allow_None=False, bounds=(0, 1), constant=True, default=True, instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
Topographica sets the mask size so that it is the same as the connection field’s size, unless this parameter is False - in which case the user-specified size of the cf_shape is used. In normal usage of Topographica, this parameter should remain True.
param Boolean allow_null_cfs (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not the projection can have entirely empty CFs
param Integer min_matrix_radius (allow_None=False, bounds=(0, None), constant=False, default=1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Enforced minimum for radius of weights matrix. The default of 1 gives a minimum matrix of 3x3. 0 would allow a 1x1 matrix.
param ClassSelector learning_fn (allow_None=False, constant=False, default=<CFPLF_Plugin CFPLF_Plugin01283>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function for computing changes to the weights based on one activation step.
param String hash_format (allow_None=False, basestring=<type ‘basestring’>, constant=False, default={name}-{src}-{dest}, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Format string to determine the hash value used to initialize random weight generation. Format keys available include {name} {src} and {dest}.
param Parameter src (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.1, readonly=False)
The EventProcessor from which messages originate.
param ClassSelector weights_generator (allow_None=False, constant=True, default=<Constant Constant01281>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Generate initial weights values.
param HookList weights_output_fns (allow_None=False, bounds=(0, None), constant=False, default=[CFPOF_Plugin(name=’CFPOF_Plugin01285’, single_cf_fn=IdentityTF(init_keys=[], name=’IdentityTF01286’, norm_value=None))], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Functions applied to each CF after learning.
param HookList input_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the input before the projection activity is computed.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the projection activity after it is computed.
activate(input_activity)

Activate using the specified response_fn and output_fn.

apply_learn_output_fns(active_units_mask=True)

Apply the weights_output_fns to each unit.

If active_units_mask is True, inactive units will be skipped.

cf(r, c)

Return the specified ConnectionField

cf_bounds(r, c)

Return the bounds of the specified ConnectionField.

cf_type

alias of ConnectionField

change_bounds(nominal_bounds_template)

Change the bounding box for all of the ConnectionFields in this Projection.

Calls change_bounds() on each ConnectionField.

Currently only allows reducing the size, but should be extended to allow increasing as well.

change_density(new_wt_density)

Rescales the weight matrix in place, interpolating or resampling as needed.

Not yet implemented.

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2b07af984d60>
get_param_values(onlychanged=False)

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object at 0x2b07af984e68>
inspect_value = <functools.partial object at 0x2b07af984ec0>
learn()

For a CFProjection, learn consists of calling the learning_fn.

message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

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 Projection to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

For instance, if new_plasticity_state is False, in a Projection with modifiable connection weights, the values of those weights should temporarily be made fixed and unchanging after this call. For a Projection with automatic normalization, homeostatic plasticity, or other features that depend on a history of events (rather than just the current item being processed), changes in those properties would be disabled temporarily. Setting the plasticity state to False is useful during analysis operations (e.g. map measurement) that would otherwise change the state of the underlying network.

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, this call simply calls override_plasticity_state() on the Projection’s output_fn, and sets the ‘plastic’ parameter to False.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

projection_view(timestamp=None)

Returns the activity in a single projection

remove()

Remove this connection from its src’s list of out_connections and its dest’s list of in_connections.

restore_plasticity_state()

Restore previous plasticity state 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, e.g. to reenable plasticity of any type that was disabled.

script_repr(imports=, []prefix=' ')

Generate a runnable command for creating this connection.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2b07af354470>
set_param = <functools.partial object at 0x2b07af3544c8>
state_pop()

Pop the most recently pushed activity state of the stack.

state_push()

Push the current activity state onto the stack.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

view(sheet_x, sheet_y, timestamp=None, situated=False, **kwargs)

Return a single connection field Image, for the unit located nearest to sheet coordinate (sheet_x,sheet_y).

warning(msg, *args, **kw)

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class topo.projection.CFProjection(initialize_cfs=True, **params)

Bases: topo.base.projection.Projection

A projection composed of ConnectionFields from a Sheet into a ProjectionSheet.

CFProjection computes its activity using a response_fn of type CFPResponseFn (typically a CF-aware version of mdot) and output_fns (typically none). The initial contents of the ConnectionFields mapping from the input Sheet into the target ProjectionSheet are controlled by the weights_generator, cf_shape, and weights_output_fn parameters, while the location of the ConnectionField is controlled by the coord_mapper parameter.

Any subclass has to implement the interface activate(self,input_activity) that computes the response from the input and stores it in the activity array.

param Number precedence (allow_None=False, bounds=None, constant=False, default=0.8, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)

param Boolean private (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Set to true if this connection is for internal use only, not to be manipulated by a user.
param Integer seed (allow_None=True, bounds=None, constant=False, default=None, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
The random seed used to determine the randomized weight initialization stream. If not None, equivalent to appending the chosen integer to the hash_format.
param Boolean apply_output_fns_init (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 function to connection fields (e.g. for normalization) when the CFs are first created.
param Parameter dest_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False)
Identifier that can be used to distinguish different types of incoming connections. EventProcessors that accept only a single type of incoming event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for dest_port. It is up to the dest EventProcessor to process the data appropriately for each port, and to define what is expected to be sent to that port.
param Number strength (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Global multiplicative scaling applied to the Activity of this Sheet.
param Parameter src_port (allow_None=False, constant=False, default=Activity, instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False)
Identifier that can be used to distinguish different types of outgoing connections. EventProcessors that generate only a single type of outgoing event will typically use a src_port of None. However, if multiple types of communication are meaningful, the EventProcessor can accept other values for src_port. It is up to the src EventProcessor to deliver appropriate data to each port, and to declare what will be sent over that port.
param Parameter cf_type (allow_None=False, constant=True, default=<class ‘topo.base.cf.ConnectionField’>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Type of ConnectionField to use when creating individual CFs.
param ClassSelector cf_shape (allow_None=False, constant=True, default=<Constant Constant01282>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Mask pattern to define the shape of the connection fields.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to update the internal state on each call. Allows plasticity to be turned off during analysis, and then re-enabled.
param Number delay (allow_None=False, bounds=(0, 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>)
Simulation time between generation of an Event by the src and delivery to the dest. Should normally be nonzero, to represent a causal with a well-defined ordering of events.
param BoundingRegionParameter nominal_bounds_template (allow_None=False, constant=False, default=BoundingBox(radius=0.1), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Bounds defining the Sheet area covered by a prototypical ConnectionField. The true bounds will differ depending on the density (see create_slice_template()).
param ClassSelector response_fn (allow_None=False, constant=False, default=<CFPRF_Plugin CFPRF_Plugin01279>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function for computing the Projection response to an input pattern.
param Boolean same_cf_shape_for_all_cfs (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to share a single cf_shape mask for all CFs. If True, the cf_shape is evaluated only once and shared for all CFs, which saves computation time and memory. If False, the cf_shape is evaluated once for each CF, allowing each to have its own shape.
param Parameter activity_group (allow_None=False, constant=False, default=(0.5, <ufunc ‘add’>), instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Grouping and precedence specifier for computing activity from Projections. In a ProjectionSheet, all Projections in the same activity_group will be summed, and then the results from each group will be combined in the order of the activity_group using the operator specified by the activity_operator. For instance, if there are two Projections with activity_group==(0.2,numpy.add) and two with activity_group==(0.6,numpy.divide), activity from the first two will be added together, and the result divided by the sum of the second two.
param ClassSelector coord_mapper (allow_None=False, constant=False, default=<IdentityMF IdentityMF01287>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function to map a projected coordinate into the target sheet.
param Number mask_threshold (allow_None=False, bounds=None, constant=True, default=0.5, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
If a unit is above this value in the cf_shape mask, it is included; otherwise it is excluded from the mask.
param Parameter dest (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.11, readonly=False)
The EventProcessor to which messages are delivered.
param Number learning_rate (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Amount of learning at each step for this projection, specified in units that are independent of the density of each Sheet.
param Boolean autosize_mask (allow_None=False, bounds=(0, 1), constant=True, default=True, instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
Topographica sets the mask size so that it is the same as the connection field’s size, unless this parameter is False - in which case the user-specified size of the cf_shape is used. In normal usage of Topographica, this parameter should remain True.
param Boolean allow_null_cfs (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not the projection can have entirely empty CFs
param Integer min_matrix_radius (allow_None=False, bounds=(0, None), constant=False, default=1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Enforced minimum for radius of weights matrix. The default of 1 gives a minimum matrix of 3x3. 0 would allow a 1x1 matrix.
param ClassSelector learning_fn (allow_None=False, constant=False, default=<CFPLF_Plugin CFPLF_Plugin01283>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Function for computing changes to the weights based on one activation step.
param String hash_format (allow_None=False, basestring=<type ‘basestring’>, constant=False, default={name}-{src}-{dest}, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Format string to determine the hash value used to initialize random weight generation. Format keys available include {name} {src} and {dest}.
param Parameter src (allow_None=True, constant=True, default=None, instantiate=True, pickle_default_value=True, precedence=0.1, readonly=False)
The EventProcessor from which messages originate.
param ClassSelector weights_generator (allow_None=False, constant=True, default=<Constant Constant01281>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Generate initial weights values.
param HookList weights_output_fns (allow_None=False, bounds=(0, None), constant=False, default=[CFPOF_Plugin(name=’CFPOF_Plugin01285’, single_cf_fn=IdentityTF(init_keys=[], name=’IdentityTF01286’, norm_value=None))], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Functions applied to each CF after learning.
param HookList input_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the input before the projection activity is computed.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Function(s) applied to the projection activity after it is computed.
activate(input_activity)

Activate using the specified response_fn and output_fn.

apply_learn_output_fns(active_units_mask=True)

Apply the weights_output_fns to each unit.

If active_units_mask is True, inactive units will be skipped.

cf(r, c)

Return the specified ConnectionField

cf_bounds(r, c)

Return the bounds of the specified ConnectionField.

cf_type

alias of ConnectionField

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2b07af984cb0>
get_param_values(onlychanged=False)

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object at 0x2b07af984b50>
inspect_value = <functools.partial object at 0x2b07af984838>
learn()

For a CFProjection, learn consists of calling the learning_fn.

message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

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 Projection to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

For instance, if new_plasticity_state is False, in a Projection with modifiable connection weights, the values of those weights should temporarily be made fixed and unchanging after this call. For a Projection with automatic normalization, homeostatic plasticity, or other features that depend on a history of events (rather than just the current item being processed), changes in those properties would be disabled temporarily. Setting the plasticity state to False is useful during analysis operations (e.g. map measurement) that would otherwise change the state of the underlying network.

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, this call simply calls override_plasticity_state() on the Projection’s output_fn, and sets the ‘plastic’ parameter to False.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

projection_view(timestamp=None)

Returns the activity in a single projection

remove()

Remove this connection from its src’s list of out_connections and its dest’s list of in_connections.

restore_plasticity_state()

Restore previous plasticity state 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, e.g. to reenable plasticity of any type that was disabled.

script_repr(imports=, []prefix=' ')

Generate a runnable command for creating this connection.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2b07af984c58>
set_param = <functools.partial object at 0x2b07af984890>
state_pop()

Pop the most recently pushed activity state of the stack.

state_push()

Push the current activity state onto the stack.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

view(sheet_x, sheet_y, timestamp=None, situated=False, **kwargs)

Return a single connection field Image, for the unit located nearest to sheet coordinate (sheet_x,sheet_y).

warning(msg, *args, **kw)

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class topo.projection.CFPOF_SharedWeight(**params)[source]

Bases: topo.base.cf.CFPOutputFn

CFPOutputFn for use with SharedWeightCFProjections.

Applies the single_cf_fn to the single shared CF’s weights.

param ClassSelector single_cf_fn (allow_None=False, constant=False, default=<IdentityTF IdentityTF01502>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2b07af984aa0>
get_param_values(onlychanged=False)

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object at 0x2b07af9849f0>
inspect_value = <functools.partial object at 0x2b07af984af8>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2b07af984730>
set_param = <functools.partial object at 0x2b07af9847e0>
state_pop()

Restore the most recently saved state.

See state_push() for more details.

state_push()

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.


optimized Module

Optimized versions of Projection classes.