New classes should interface to this class as a generic InternalNeuralRegion instead.
Definition at line 289 of file kernel.c.
Public Methods | |
LissomMap (const string &name_i, Dimensions dims, bool init_weights_, ParamMap *params_) | |
Constructor. | |
virtual void | activate (bool learn=false, bool settle=true, bool activatefn=true) |
Activate the map given the current inputs. | |
virtual void | backproject () |
yschoe: backprojection from map to input: this code was ripped from response_to_input, and made unoptimized. | |
virtual void | backproject (const string &name, const double gammaaff=1.0) |
Backproject local core routine: replaces call to parent class' slower backproject(). | |
virtual const WeightMatrix | get_weights (const string &name, int ui=0, int uj=0) const |
Provides standard interface for accessing weights. | |
virtual NeuralRegion * | get_input (const string &name) |
Returns the specified input region for a unit. | |
virtual void | prune () |
Dead connections have a small negative value on them. | |
virtual void | save_state (const string &) |
Appends snapshot to filebase.{t}. | |
virtual bool | restore_state (const int, const string &) |
Loads ASCII or binary-format snapshot from filebase.{t} from which to continue. | |
virtual double | size_connection_bytes () const |
Memory requirements per PE. | |
virtual double | size_unique_connections () const |
Total number of connections. | |
virtual void | add_input (const string &name_, NeuralRegion &upstream_region, WeightFunction &fn, Length size_scale) |
Declare that the given region gives input to this region, and define any connections needed. | |
virtual Dimensions | input_dimensions (WeightFunction &fn, Length size_scale=1.0) |
Computes input dimensions that would be required to avoid border effects. | |
virtual WeightBounds * | get_weights_bounds (const string &name, int ui=0, int uj=0) const |
Allocates and returns a BoundingBox on the map for the weights of the given unit; all active weights must lie within. | |
virtual int | num_aff_inputs () const |
Protected Types | |
typedef std::vector< actlist > | ActivityListTable |
typedef MatrixType< int >::rectangular | MarkerType |
typedef std::vector< double > | SumType |
typedef NeuralRegion::ActivityMatrix | aff_input_type |
typedef std::vector< const aff_input_type * > | aff_inputs_type |
typedef Boundary::BoundingCircle< int, int > | BoundingCircle |
typedef Boundary::AARBoundingBox< int, int > | BoundingRectangle |
typedef std::vector< Input * > | inputs_type |
Type to use for storing inputs. | |
Protected Methods | |
void | present_inputs (bool learn, bool settle=true, bool activate=true) |
Main function called at each iteration to present inputs and modify the weights accordingly. | |
void | init_weights (bool init_weights) |
Initialize active weights to specified values. | |
void | collect_activation_data (int dest_pe=Uninitialized) |
Some data is ordinarily left distributed on each PE because it is not needed on every PE for the core LISSOM algorithm. | |
double | dist_lat_wt (double value, double amt_of_randomness) |
This function returns a value randomly distributed within a range value*amt_of_randomness on either side of value. | |
double | lat_resp (int ui, int uj, int radius, int array_width, l_weight *weights, int weight_idx_bound) |
Computes lateral excitation or inhibition response with the given weight vectors and radius. | |
double | lat_resp_rad1 (int ui, int uj, int radius, int array_width, int array_width_2, l_weight *weights, int weight_idx_bound) |
Optimized case when radius is just 0 or 1, mainly for excitation resp of organized map. | |
double | lat_resp_named (int ui, int uj, const string &name) |
Computes lateral excitation or inhibition response with the given named weights. | |
double | sigmoid (double activity, double sigdelta, double sigbeta) |
Transform the activity to a sigmoid response between 0 and 1.0. | |
double | truesigmoid (double activity, double beta) |
Transform the activity to a true sigmoid response between -1.0 and 1.0. | |
double | truesigmoidprime (double sigmoidactivity, double beta) |
Calculate the derivative of true sigmoid response f'(a) given f(a). | |
double | positivesigmoid (double activity, double beta) |
Positive sigmoid shifted to the right f(a) = 1/(1+exp(-(x-0.5)*beta)). | |
double | logsigmoid (double activity, double beta) |
Transform the activity to a log response. | |
double | logsigmoidprime (double activity, double beta) |
Calculate the derivative of a log response. | |
int | binary_search (const actlist &list, int lower, int upper, int value) |
Binary search for value in ordered list of elements constrained to the index range [lower,upper]. | |
double | change_lateral_exc_radius (double old_radius, double new_radius) |
Change lateral excitatory radius for every row. | |
void | clear_weights (void) |
Intialize all weights to known values. | |
void | randomize_lat_wts (void) |
void | compute_responses (int ts, bool activate, bool continuousdynamics) |
Add up input and lateral activations. | |
void | crop_actlist (const actlist &, int lowval, int highval, int *lowidx, int *highidx) |
Given an ordered list and a range [lowval,highval], returns the range of list indexes [lowidx,highidx] which contain values in that range. | |
void | initialize_actlists (void) |
Initialize the activity list counts to zero. | |
void | initialize_markers (void) |
Initialize activity markers for optimization of lat_exc computations. | |
void | modify_all_weights (void) |
Updates each set of weights, if the associated learning rate is nonzero. | |
void | modify_lat_wts (double alpha_exc, double alpha_inh) |
Modify lateral weights by normalized Hebbian rule. | |
void | modify_latwt_loop (int i, int j, int radius, int array_width, l_weight *weights, int weight_idx_bound, double alpha) |
Assumes activity has been collected into the prev_map_activity array. | |
void | modify_latwt_loop_killed (int i, int j, int radius, int array_width, l_weight *weights, int weight_idx_bound, double alpha) |
void | modify_latwt_loop_rad1 (int ui, int uj, int radius, int array_width, int array_width_2, l_weight *weights, int weight_idx_bound, double alpha) |
Optimized case when radius is just 1. | |
void | modify_weights (double alpha, bool normalize) |
Change afferent weights by normalized Hebbian rule (sum of weights normalization). | |
void | normalize_afferent_wts (int lowk, int highk, int lowl, int highl, int row, int j, double length) |
void | normalize_lat_wts (int i, int j, int radius, int array_width, l_weight *weights) |
Renormalize a set of lateral weights of the given neuron, such as after changing the radius. | |
double | prune_circular_aff_weights (int ui, int uj, int radius, AfferentWeightsList &weights, bool smooth, double radius_trim, double smooth_trim, double length) |
Kill off connections that aren't within the specified radius. | |
void | prune_circular_lat_weights (int ui, int uj, int radius_sq, int array_width, l_weight *weights, bool smooth, double radius_trim, double smooth_trim) |
Kill off connections that aren't within the specified radius. | |
void | receptor_normalize (void) |
Output normalization for receptors. | |
void | reduce_lateral_radius (int ui, int uj, double old_radius, double new_radius, int array_width, l_weight *weights, bool circular, bool smooth, double smooth_trim) |
Redistribute and renormalize lateral excitation. | |
void | response_to_input (bool continuousdynamics) |
This code assumes that DEATH_FLAG is either (a) never used, or (b) small relative to the sum of the weights (usually 1.0). | |
void | set_markers (int radius) |
Marks whether neurons are active or not. | |
void | settle_responses (bool learn, int tsettle, bool activate, bool continuousdynamics) |
Propagate input and let the network settle. | |
void | setup_afferent_weights (Neuron &neuron, AfferentWeightsList &awts, int ui, int uj, int radius, double radius_sq, int preset, double sigma, double amt_of_randomness, bool circular, bool smooth, double radius_trim, double smooth_trim, double force_cx=-1, double force_cy=-1) |
void | setup_lateral_weights (int ui, int uj, int radius, int array_width, l_weight *weights, int preset, double sigma, double amt_of_randomness, bool circular, bool smooth, double radius_trim, double smooth_trim, int *con_killed_flag) |
Sets up lateral weights for one neuron based on where it is in the map. | |
void | verify_saved_lateral_weights (int i, int j, int radius, int array_width, l_weight *old_weights, l_weight *new_weights, double tolerance, const char *description) |
void | verify_saved_weights (double tolerance) |
cmdstat | exc_rad_setfn2 (const string &name, Typeless ¶m, const Typeless &newvalue) |
Automatically called by cmdparam.c to set this parameter. | |
int | array_radius_int (const ParamMap ¶mmap, const string &radius_param) const |
Given a radius parameter, returns the actual integer radius to be used, taking smoothing into account. | |
int | array_radius_int (const double radius_float) const |
Subscript | input_row (const Input &input, Subscript row) const |
Subscript | input_col (const Input &input, Subscript col) const |
Protected Attributes | |
OwningPointer< ParamMap > | params |
const int | num_aff |
int | exc_connections_killed |
Flag for use in modify_weights. | |
int | inh_connections_killed |
Flag for use in modify_weights. | |
const int | exc_array_width_2 |
Holds 2*exc_array_width (optimization). | |
const int | RN_sq |
RN*RN precomputed for index calculations. | |
ActivityMatrix | gather_activity |
To collect activity in each row. | |
ActivityMatrix | init_activity |
Initial map_activity over network. | |
ActivityMatrix | map_activity |
Current map_activity over network. | |
ActivityMatrix | resp_to_inp |
Temporary to compute extern response. | |
ActivityMatrix | prev_map_activity |
map activity from the last complete iter | |
ActivityListTable | activity_list |
Maintains activity lists. | |
ActivityListTable | prev_activity_list |
Maintains activity lists. | |
MarkerType | activity_marker |
True if neighbors are active. | |
SumType | aff_norm_sum |
To do a parallel fetch of the data. | |
SumType | afferent_sum |
To accumulate wts of each receptor. | |
SumType | temp_sum |
To keep the temporary sum. | |
aff_inputs_type | aff_inputs |
std::vector< string > | aff_names |
const Activity | xo |
Nominal offset relative to the origin. | |
const Activity | yo |
See xo. | |
inputs_type | inputs |
Set of inputs to this region. | |
Friends | |
class | setfnobj2_exc_rad_setfn2 |
|
Activate the map given the current inputs. Must be implemented by derived classes. Implements NeuralRegion. Definition at line 584 of file kernel.c. References collect_activation_data(), NeuralRegion::output, present_inputs(), and NeuralRegion::Subscript. |
|
Declare that the given region gives input to this region, and define any connections needed. The connections will have the given name. Accepts fn (a unary function of size_scale) to initialize the weights. Implements InternalNeuralRegion. Definition at line 607 of file kernel.c. References assert_equals, NeuralRegion::const_activity(), Generic::insert_named(), and InternalNeuralRegion::WeightMatrix. |
|
Binary search for value in ordered list of elements constrained to the index range [lower,upper]. If the value is found, its index is returned; otherwise the next higher index is returned. Definition at line 1574 of file kernel.c. Referenced by crop_actlist(). |
|
Some data is ordinarily left distributed on each PE because it is not needed on every PE for the core LISSOM algorithm. This procedure collects such data onto the specified PE for simpler graphing and/or analysis. If pe is Uninitialized the data is broadcast to all PEs. This does not need to be called when NPES==1, but it won't take any time to do so. Definition at line 2904 of file kernel.c. References ipc_barrier(), and MAPROW. Referenced by activate(). |
|
Add up input and lateral activations. Does NOT check for DEATH_FLAG. Make sure that DEATH_FLAG is much less than 1.0 so that dead weights will not significantly affect the results. Definition at line 1439 of file kernel.c. References ACTLIST_START, BasicLissomMap::cortex_map, ipc_barrier(), lat_resp(), lat_resp_rad1(), MAPROW, set_markers(), shuffled_rand(), sigmoid(), and Tristate. Referenced by settle_responses(). |
|
Given an ordered list and a range [lowval,highval], returns the range of list indexes [lowidx,highidx] which contain values in that range. If (lowidx>highidx) on return, there is no item in the list in the given range. Definition at line 1599 of file kernel.c. References ACTLIST_START, and binary_search(). Referenced by lat_resp(), and modify_latwt_loop(). |
|
Provides standard interface for accessing weights. Does NOT check for DEATH_FLAG, so care needs to be taken. Implements InternalNeuralRegion. Definition at line 685 of file kernel.c. References assert_equals, BasicLissomMap::cortex_map, DEATH_FLAG, ISEQ, ROWISLOCAL, and InternalNeuralRegion::WeightMatrix. |
|
Allocates and returns a BoundingBox on the map for the weights of the given unit; all active weights must lie within. This box is not guaranteed to be the minimum such box; it generally stays the same even if units are pruned, and some types may only implement a rectangular box even if weights are internally constrained to e.g. a circular region. Implements InternalNeuralRegion. Definition at line 798 of file kernel.c. References array_radius_int(), assert_equals, NeuralRegion::Bounds, NeuralRegion::bounds(), BasicLissomMap::cortex_map, MAPROW, String::non_numeric_basename_matches(), ROWISLOCAL, and InternalNeuralRegion::WeightBounds. |
|
Initialize active weights to specified values. Each neuron is assumed to have a receptive field on the retina. The size of the receptive field of a neuron is (RN/N). Each neuron receives input from a square area of radius rf_radius from around the center of its receptive field projected on the retina. The total sum of weights is normalized to 1.0. Definition at line 2416 of file kernel.c. References clear_weights(), BasicLissomMap::cortex_map, MAPROW, BasicLissomMap::reference_wts, setup_lateral_weights(), shuffled_rand_reset(), and Tristate. Referenced by LissomMap(). |
|
Initialize activity markers for optimization of lat_exc computations. Initially all markers must be True. Definition at line 1684 of file kernel.c. References MAPROW. Referenced by settle_responses(). |
|
Computes lateral excitation or inhibition response with the given weight vectors and radius. The response is calculated only from active neurons. Does NOT check for DEATH_FLAG -- be careful. Definition at line 1734 of file kernel.c. References crop_actlist(), and PARTIAL_LAT_INDEX. Referenced by compute_responses(). |
|
Computes lateral excitation or inhibition response with the given named weights. Previous activity is taken from prev_map_activity. Definition at line 1849 of file kernel.c. References BasicLissomMap::cortex_map. |
|
Transform the activity to a log response. f(a) = 0.0 if a<=0.0, and log(1+a) if a>0.0 |
|
Calculate the derivative of a log response. f'(a) = 1/(1+a) |
|
Modify lateral weights by normalized Hebbian rule. The normalization keeps sum of lateral excitatory weights and sum of lateral inhibitory weights constant and equal to 1.0. Definition at line 2075 of file kernel.c. References BasicLissomMap::cortex_map, MAPROW, modify_latwt_loop(), and modify_latwt_loop_rad1(). Referenced by modify_all_weights(). |
|
Optimized case when radius is just 1. Assumes activity has been collected into the prev_map_activity array. Definition at line 2156 of file kernel.c. Referenced by modify_lat_wts(). |
|
Change afferent weights by normalized Hebbian rule (sum of weights normalization). Assumption required at present; it can be eliminated except when NUM_EYES_IS_CONSTANT Definition at line 1909 of file kernel.c. References BasicLissomMap::cortex_map, DEATH_FLAG, MAPROW, and receptor_normalize(). Referenced by modify_all_weights(). |
|
Main function called at each iteration to present inputs and modify the weights accordingly. When this routine completes, the following data should be available to plot or analyze (on each PE):
Variable Data Portion Same on each PE? resp_to_inp sum of afferent resp nrows x N No init_activity initial activity nrows x N No prev_map_activity settled activity N x N Yes To get all of init_activity for graphing, must call collect_activation_data() if NPES>1. Definition at line 868 of file kernel.c. References ACTLIST_START, modify_all_weights(), and settle_responses(). Referenced by activate(). |
|
Dead connections have a small negative value on them. These connections are not modified afterwards. Nor do they make any significant contribution to the response on the map because of their small value. Reimplemented from NeuralRegion. Definition at line 2750 of file kernel.c. References BasicLissomMap::cortex_map, DEATH_FLAG, ipc_pe_msg_delay(), MAPROW, NeuralRegion::name(), and normalize_lat_wts(). |
|
Redistribute and renormalize lateral excitation. Lat_exc wts are indexed based on the original exc_array_width, and the current excitation radius. So the weights from the center of the exc_wts array must be copied to this new index range, for the indexing to be still correct. Works only for reducing, not increasing lateral radius. Definition at line 2864 of file kernel.c. References array_radius_int(), normalize_lat_wts(), PARTIAL_LAT_INDEX, and prune_circular_lat_weights(). Referenced by change_lateral_exc_radius(). |
|
This code assumes that DEATH_FLAG is either (a) never used, or (b) small relative to the sum of the weights (usually 1.0). Assumption required at present; it can be eliminated except when NUM_EYES_IS_CONSTANT Definition at line 924 of file kernel.c. References NeuralRegion::ActivityMatrix, BasicLissomMap::cortex_map, get_input(), inputs, MAPROW, NeuralRegion::output, and BasicLissomMap::reference_wts. Referenced by settle_responses(). |
|
Loads ASCII or binary-format snapshot from filebase.{t} from which to continue. The ASCII format is deprecated, and may eventually be phased out. Reimplemented from NeuralRegion. Definition at line 3012 of file kernel.c. References clear_weights(), ipc_abort(), and StateSaver::read(). Referenced by save_state(). |
|
Appends snapshot to filebase.{t}. The output is ASCII weight values. The ASCII format is deprecated, and may eventually be phased out. Reimplemented from NeuralRegion. Definition at line 2938 of file kernel.c. References clear_weights(), BasicLissomMap::cortex_map, ipc_abort(), ipc_barrier(), ipc_exit(), MAPROW, restore_state(), and StateSaver::write(). |
|
Marks whether neurons are active or not. If there is any activity in the given neighborhood radius, markers are set to True, otherwise they are set to False for the remainder of the settling iteration. Saves a lot of computation. Definition at line 1702 of file kernel.c. References MAPROW. Referenced by compute_responses(). |
|
Sets up lateral weights for one neuron based on where it is in the map. Neurons at the border have fewer connections than at the center. Note that inhibition wts are initialized to positive. The lateral wts are distributed around the mean with the given randomness. The lowk,lowl,highk,highl variables keep track of the spread of connections. Connections can at most spread to both borders of the network. Definition at line 2586 of file kernel.c. References dist_lat_wt(), normalize_lat_wts(), and prune_circular_lat_weights(). Referenced by init_weights(). |
|
Transform the activity to a sigmoid response between 0 and 1.0. Between the thresholds, response is linear. Definition at line 2297 of file kernel.c. Referenced by compute_responses(). |
|
Transform the activity to a true sigmoid response between -1.0 and 1.0. f(a) = 1+e^-a / e^a+e^-a Definition at line 2313 of file kernel.c. Referenced by backproject(). |
|
Calculate the derivative of true sigmoid response f'(a) given f(a). f'(a) = Beta * (1-f(a)^2) |
|
Nominal offset relative to the origin. Only used by input_dimensions. |
|
See xo. Only used by input_dimensions. |