niml.model.nispooler package

Submodules

niml.model.nispooler.sp_pooler_c module

Implementation of the NNP Spatial Pooler

class niml.model.nispooler.sp_pooler_c.SpatialPooler(pooler_state=None, sdr_width=None, neurons=None, active_neurons=None, input_pct=None, learning=None, synapse_inc=None, synapse_dec=None, boost_frequency=5, decay_cnt_target=None, seed=None, sdr_set_bits=None, boost_strength=0.175, boost_bend_factor=0.25, boost_table_length=128, force_software=False)

Develops synaptic connections based on common characteristics detected during processing of observations as iSDRs.

pooler_stateString

Pathname of a file containing a binary pooler configuration.

sdr_widthint

Represents the full width of SDRs for all features to be processed by the compute method

neuronsint

Value defining how many columns to use for training the model

active_neuronsint

Indicates the number of winning columns to use in creating the oSDR signature (must be less than neurons parameter)

input_pctfloat

Used during configuration to force a certain percentage of the synapses in a column to be turned off (set to 0). A lower number will force more synapses to be turned off (must be between 0 and 1 inclusive)

learningbool

Informs the model to update synapses with new information(True) or to maintain existing state(False)

synapse_incint

Value added to the synaptic strength value for a synapse that matches the iSDR signature to encourage winning by perpetual losing neurons (only applies when learning is on and must be >= 1)

synapse_decint

Value subtracted from the synaptic strength value for a synapse that did not match the iSDR signature to discourage excessive winning by the same neurons (only applies when learning is on and must be >= 1)

boost_frequencyint

Indicates the upper and lower bounds when the pooler will trigger a boost table index increment or decrement; this is the outer loop that gets invoked when the decay_cnt_target is reached (only applies when learning is on and must be >= 1)

decay_cnt_targetint

Sets the number of iSDRs to process before triggering an adjustment to the outer boost_frequency loop (only applies when learning and must be between 2 and 256 inclusive)

sdr_set_bitsint

The number of set-bits used in a complete sdr

boost_strengthfloat

Determines the highest possible value for boost table entries. 0 < boost_strength <= 1.0. Default value = 0.175

boost_bend_factorfloat

Determines the sharpness of the curve in the boost table. Higher values correspond to tighter curves and a steeper slope of the boost curve. Practical maximum value 0.5. 0 < boost_bend_factor <= 1.0. Default value = 0.175

boost_table_lengthint

Sets the total number of boost table steps. A higher value will result in a more gradual boosting profile and a lower number will cause boosting to change more rapidly:: 1 < boost_table_length <= 256, Default value = 1

seed

Value that ge ts passed to the random initialization function to allow for repeatable output0

force_softwarebool, optional
When true, disalows the use of a hardware pooler, even if

available.

When false, a hardware pooler will be used if available. Defaults

to False.

property active_neurons

getter method using property decorator

property boost_bend_factor

getter method using property decorator

property boost_frequency

getter method using property decorator

property boost_strength

getter method using property decorator

property boost_table_length

getter method using property decorator

static check_bounded_int(value, caller, lbound=0, ubound=65536)

Throws an error if int ‘value’ is outside its proper range given the optional lbound and ubound. One of the two bounds is required. Checks for: - greater than lbound (else error) - less than ubound (else error) - both (else error)

static check_float_zero_to_one(value, caller)

Throws an error if float ‘value’ is outside its proper range value should be greater than 0.0 and value should be less than or equal to 1.0

property decay_cnt_target

getter method using property decorator

fit(isdrs=None, encoder_state=None, batch_size=1)

Performs one cycle of training with the passed isdrs or encoder state

Parameters
  • encoder_state (dict, optional) – a state dictionary from the encoder

  • isdrs (list of lists, optional) – encoded iSDRs (Note: encoder_state and isdrs may not both be NULL).

  • batch_size (int, optional) – number SDRs to process between updates of boost factor and synaptic connection status.

Return type

Resulting oSDR collection.

get_pooler_state()
Method that builds and returns a dictionary representing all

the global and per column state parameters

Return type

Anonymous dictionary of the current state of the pooler object

get_pooler_type()

Returns a string indicating the type of pooler instantiated. Current possibilities: - “Loki” a hardware accelerated pooler - “Software” software only pooler without hardware acceleration. - “Software LI” software only pooler with Local Inhibition support.

property input_pct

getter method using property decorator

is_hardware()

Returns true if the instantiated pooler is hardware accelerated. Returns false otherwise.

property learning

getter method using property decorator

property neurons

getter method using property decorator

static num_poolers()

Returns the number of poolers currently instantiated.

predict(isdrs=None, encoder_state=None, batch_size=1)

Performs one cycle of inference with the passed isdrs or encoder state

Parameters
  • encoder_state (dict, optional) – a state dictionary from the encoder

  • isdrs (list of lists, optional) – encoded iSDRs (Note: encoder_state and isdrs may not both be NULL).

  • batch_size (int, optional) – number SDRs to process between updates of boost factor and synaptic connection status.

Return type

Resulting oSDR collection.

save_osdr_binary(output_file)

Saves most recent osdrs to a binary file.

Parameters

output_file (strind) – pathname for the saved osdr file.

Return type

Nothing

save_pooler(output_file)

Saves current pooler state to a binary file.

Parameters

output_file (strind) – pathname for the saved state file.

Return type

Nothing

save_pooler_binary(output_file)

Saves current pooler state to a binary file.

Parameters

output_file (strind) – pathname for the saved state file.

Return type

Nothing

property sdr_set_bits

getter method using property decorator

property sdr_width

getter method using property decorator

property synapse_dec

getter method using property decorator

property synapse_inc

getter method using property decorator

static validate_neuron_settings(neurons, act_neurons)

Checks to ensure that act_neurons is less than (or equal) to neurons