Stochastic Bricks

class fugu.bricks.stochastic_bricks.PRN(probability=0.5, steps=None, shape=(1,), name='PRN', output_coding='Undefined')

Bases: Brick

Psuedo-random neuron brick. Generates spikes randomly (a uniform random [0,1] draw is compared against a threshold).

Constructor for this brick. :param probability: Probability of a spike at any timestep :param steps: Number of timesteps to produce spikes. None provides un-ending output. :param shape: shape of the neurons in the brick :param output_coding: Desired output coding for the brick

build(graph, metadata, control_nodes, input_lists, input_codings)

Build Register brick.

Parameters:
  • graph – networkx graph to define connections of the computational graph

  • metadata (dict) – dictionary to define the shapes and parameters of the brick

  • control_nodes (dict) –

    dictionary of lists of auxillary networkx nodes. Expected keys:

    ’complete’ - A list of neurons that fire when the brick is done

  • input_lists (list) – list of nodes that will contain input

  • input_coding (list) – list of input coding formats. All coding types supported

Returns:

graph of a computational elements and connections self.metadata: dictionary of output parameters (shape, coding, layers, depth, etc) complete (str): dictionary of control nodes (‘complete’) output_list (list): list of output self.output_coding (list): list of coding formats of output

Return type:

graph

Raises:

ValueError – PRN brick requires at least 1 input

class fugu.bricks.stochastic_bricks.Threshold(threshold, decay=0.0, p=1.0, name='Threshold', output_coding=None)

Bases: Brick

Class to handle Threshold Brick. Inherits from Brick

Construtor for this brick. :param threshold: Threshold value. For input coding ‘current’, float. For ‘temporal-L’, int. :param decay: Decay value for threshold neuron (‘current’ input only) :type decay: float :param p: Probability of firing when exceeding threshold (‘current’ input only) :type p: float :param name: Name of the brick. If not specified, a default will be used. Name should be unique. :type name: str :param output_coding: Force a return of this output coding. Default is ‘unary-L’

set_properties(properties={})

Returns an updated version of the graph based on the property values passed.

build(graph, metadata, control_nodes, input_lists, input_codings)

Build Threshold brick. :param graph: networkx graph to define connections of the computational graph :param metadata: dictionary to define the shapes and parameters of the brick :type metadata: dict :param control_nodes: list of dictionary of auxillary nodes.

Expected keys:

‘complete’ - A neurons that fire when the brick is done ‘begin’ - A neurons that first when the brick begins processing (for temporal coded inputs)

Parameters:
  • input_lists (list) – list of nodes that will contain input

  • input_coding (list) – list of input coding formats

Returns:

graph of a computational elements and connections self.metadata (dict): dictionary of output parameters (shape, coding, layers, depth, etc) new_complete_node: list dictionary of control nodes (‘complete’) output_lists (list[list[str]]): list of output output_codings (list[str]): list of coding formats of output

Return type:

graph