Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

globals.c

Go to the documentation of this file.
00001 
00012 #include <string.h>
00013 #include <math.h>
00014 
00015 #include "ipc.h"
00016 #include "cmdparam.h"
00017 #include "globals.h"
00018 #include "shuffledrand.h"
00019 
00020 
00021 /* Public parameters */
00022 string filebase="lissom";
00023 int    iteration=0;
00024 int    presentation=0;
00025   
00026 /* Global variables */
00027 int    MyPE=0;                          
00028 int    network_initialized=False;       
00029 int    NPEs=1;                          
00032 /******************************************************************************/
00033 /* Prototypes for private functions                                           */
00034 /******************************************************************************/
00035 
00036 CMD_DECLARE(save_params);
00037 
00038 /* Wrappers for obsolete legacy functions; to be removed eventually */
00039 CMD_DECLARE(plot_weights);
00040 CMD_DECLARE(plot_activity);
00041 CMD_DECLARE(plot_afferent_weight_map);
00042 CMD_DECLARE(measure_od_pref);
00043 CMD_DECLARE(measure_or_pref);
00044 CMD_DECLARE(OD_features);
00045 CMD_DECLARE(OR_features);
00046 CMD_DECLARE(plot_od_pref);
00047 CMD_DECLARE(plot_or_pref);
00048 
00049 
00050 /******************************************************************************/
00051 /* Initialization hook                                                        */
00052 /******************************************************************************/
00053 
00054 void  globals_init_hook( void )
00055 {
00056   /* Initialize cached copy of PE number and number of PEs total */
00057   MyPE = ipc_my_process();    
00058   NPEs = ipc_num_processes(); 
00059 
00060   
00061   /* Commands */  
00062   CMD_DOC(save_params,NULL,0,"%s <filename>",
00063           "Save current values of parameters and currently-defined hooks in a format\n"
00064           "suitable for exec_file.");
00065 
00066   /* Global parameters defined in this file */  
00067 
00068   PARAM_N(PARAM_USTRING,filebase,
00069           "Basename to use for files to be created during this run.");
00070   
00071   PARAM_A(blackboard,"area_scale",1.0,.add_lower_bound(0.0),
00072           "Ratio between the canonical reference areas BaseN*BaseN and BaseRN*BaseRN\n"
00073           "and the actual area desired.  Used to smoothly scale the total cortical and\n"
00074           "input area simulated, as opposed to simulating at a finer or coarser level\n"
00075           "of detail (which may instead be obtained by varying BaseN and/or BaseRN).");
00076   SETFN_DEFINE2(area_scale,fixed_arch_param_setfn2);
00077   
00078   PARAM_A(blackboard,"BaseN",36,.add_lower_bound(0),
00079           "The width and height of a canonical square reference area of a cortical region.\n"
00080           "Used to calculate parameters and default values which are independent of the\n"
00081           "actual total size of the cortex.");
00082   SETFN_DEFINE2(BaseN,fixed_arch_param_setfn2);
00083   
00084   PARAM_A(blackboard,"N",36,.add_lower_bound(0), 
00085           "The (square) size of the cortical map, i.e. NxN.  This parameter is currently\n"
00086           "unused and may not always match the network(s) in use.");
00087   SETFN_DEFINE2(N,fixed_arch_param_setfn2);
00088   params_define_default_expr("N","BaseN*area_scale");
00089   
00090   CONST_I(NPEs,NPES,True,
00091           "The number of processing elements (PEs) assigned to this job.  This is\n"
00092           "determined by the compile-time constant NPES.  With more PEs, more\n"
00093           "memory and processing power are available, but because the LISSOM\n"
00094           "algorithm requires an enormous amount of interprocessor communication,\n"
00095           "the speedup is not linear in the number of processors.  In fact, with\n"
00096           "most ordinary communications methods such as Ethernet, going from\n"
00097           "NPEs=1 to NPEs=2 could actually slow down the computation.  Still,\n"
00098           "for large problems there is usually no other way to get all the memory\n"
00099           "and processing power needed.\n\n"
00100 
00101           "Note that when NPEs changes, the result changes as if a different random\n"
00102           "seed was chosen.  This occurs because each processor computes random numbers\n"
00103           "independently, and so a different sequence of random numbers is chosen than\n"
00104           "if a single processor had computed them all.  This could be alleviated by\n"
00105           "having a single processor compute all random numbers, but that (and the\n"
00106           "communication it would involve) would probably slow things down considerably.");
00107 
00108   PARAM_A(blackboard,"num_eyes",2,.add_lower_bound(0),
00109           "The default number of sheets of photoreceptors (eyes) to attach to the network.\n\n"
00110 
00111           "This parameter is ignored if you define your own input regions using\n"
00112           "define_region.  The number of eyes can be arbitrarily large, which may\n"
00113           "be interesting for studying experimental manipulations such as Reh &\n"
00114           "Constantine-Paton, J. Neurosci 5:5 1985, \"... Three-Eyed Rana pipiens\".");
00115   SETFN_DEFINE2(num_eyes,fixed_arch_param_setfn2);
00116   
00117   PARAM_A(blackboard,"layers_pereye",0,.add_lower_bound(0),
00118           "The default number of retinal ganglion cell layers to attach to each eye.\n\n"
00119 
00120           "This parameter will often be 0, which means the input (photoreceptor) layer\n"
00121           "will be connected directly to the cortex.  In such cases one should ensure\n"
00122           "that the patterns drawn on the input layer are appropriate representations\n"
00123           "of the output of the LGN, e.g. that they have been blurred and are sparse.\n"
00124           "If layers_pereye is nonzero, that many ganglion cell layers will be created,\n"
00125           "each normally consisting of a homogenous group of cells, e.g. a set of\n"
00126           "OFF-center cells at a particular size.  You can use any number of such groups\n"
00127           "with different weight kernels.  See blur_type for more information.\n");
00128   SETFN_DEFINE2(layers_pereye,fixed_arch_param_setfn2);
00129   
00130   PARAM_L(PARAM_INT,   presentation,0,
00131           "Counter for inputs presented at a single training iteration t.  It will\n"
00132           "usually remain at zero, but if extra inputs are presented for testing or\n"
00133           "other purposes, this counter will advance each time.  The concatenation\n"
00134           "of t with this counter will then be sufficient to label that input\n"
00135           "presentation uniquely, e.g. for the purposes of creating a unique filename.");
00136   
00137   PARAM_A(blackboard,"BaseRN",36,.add_lower_bound(0),
00138           "The width and height of a canonical square reference area of an input region.\n"
00139           "Used to calculate parameters and default values which are independent of the\n"
00140           "actual total size of the input region.");
00141   SETFN_DEFINE2(BaseRN,fixed_arch_param_setfn2);
00142   
00143   PARAM_A(blackboard,"RN",24,.add_lower_bound(0),
00144           "The size of the (square) input retina matrix, i.e. RNxRN."); 
00145   SETFN_DEFINE2(RN,fixed_arch_param_setfn2);
00146   params_define_default_expr("RN","BaseRN*area_scale+2*retina_edge_buffer");
00147   
00148   PARAM_NN(PARAM_INT,   seed, &(ShuffledRandom<double>::default_seed),
00149           "Seed for random number generator used to generate initial weights, etc.  See\n"
00150           "also inputs_seed if applicable.");
00151   SETFN_DEFINE2(seed,fixed_arch_param_setfn2);
00152   
00153   PARAM_L(PARAM_INT,   iteration,0,
00154           "The current training iteration.  Iteration 0 is used for init_network to\n"
00155           "make sure everything is initialized properly, without doing any learning.");
00156   /* Define "t" alias for "iteration" */
00157   blackboard.define_param(DECLARE_PARAM(PARAM_INT,"t",false,&iteration));
00158   params_add_lower_bound_int("t",0);
00159   params_define_doc("t","Alias for the `iteration' parameter.");
00160                                                       
00161   {
00162     static int i;
00163     static double f;
00164     
00165     PARAM_N(PARAM_INT,i,
00166             "Integer register predefined for convenience; suitable for use as\n"
00167             "e.g. a loop index.  Since many different user routines can use\n"
00168             "this parameter, don't expect its value to remain unchanged.");
00169     
00170     PARAM_N(PARAM_DOUBLE,f,
00171             "Floating-point register predefined for convenience; suitable for use\n"
00172             "as a temporary value e.g. in a loop.  Since many different user routines\n"
00173             "can use this parameter, don't expect its value to remain unchanged.");
00174   }
00175 
00176 
00177   /* Wrappers for obsolete legacy functions; to be removed eventually */
00178   CMD_DOC(plot_activity,"init_network",0,"%s [<filename>]",
00179           "Wrapper for legacy parameter file support: executes 'plot Activity'.");
00180   
00181   CMD_DOC(plot_weights,"init_network",0,"%s [<ui> <uj>]*",
00182           "Wrapper for legacy parameter file support: executes 'plot_unit' with the.\n"
00183           "argument order swapped to match changed conventions.");
00184 
00185   CMD_DOC(plot_afferent_weight_map,"init_network",0,"%s [<eye> [<filename>]]",
00186           "Wrapper for legacy parameter file support: executes 'plot_unit_range'.");
00187 
00188   CMD_DOC(measure_od_pref,"init_network",0, "%s [<low> [<high>]]",
00189           "Wrapper for legacy parameter file support: executes 'call measure_od_pref'\n"
00190           "and then 'plot OcularPreference'.");
00191   
00192   CMD_DOC(measure_or_pref,"init_network",0, "%s [<low> [<high> [<plot_filename>]]]",
00193           "Wrapper for legacy parameter file support: executes 'call measure_or_pref'\n"
00194           "and then 'plot OrientationPreference'.");
00195 
00196   CMD_DOC(OD_features,"init_network",0,"%s [<low> [<high> [<nexamples>]]]","Unimplemented.");
00197   
00198   CMD_DOC(OR_features,"init_network",0,"%s [<low> [<high> [<nexamples> [<calc_select>]]]]",
00199           "Unimplemented.");
00200   
00201   CMD_DOC(plot_od_pref,"init_network",0, "%s [<low> [<high> [<filename>]]]",
00202           "Wrapper for legacy parameter file support: executes 'call measure_or_pref'\n"
00203           "and then 'plot OrientationPreference'.");
00204 
00205   CMD_DOC(plot_or_pref,"init_network",0, "%s [<low> [<high> [<filename>] [<selectivity_only]]]",
00206           "Wrapper for legacy parameter file support: executes\n"
00207           "'plot OrientationPreference'.");
00208 }
00209 
00210 
00212 void kernel_init_hook( void )
00213 {
00214   PARAM_A(blackboard,"circular_aff_wts",True,.add_lower_bound(False).add_upper_bound(True),
00215           "If this is true, all afferent weights outside a circular radius\n"
00216           "rf_radius will be killed before training begins.  Otherwise a\n"
00217           "square radius is used.");
00218   SETFN_DEFINE2(circular_aff_wts,fixed_arch_param_setfn2);
00219   
00220   PARAM_A(blackboard,"circular_lat_wts",True,.add_lower_bound(False).add_upper_bound(True),
00221           "If this is true, all lateral weights outside a circular radius\n"
00222           "exc_rad or inh_rad (for the excitatory and inhibitory weights,\n"  
00223           "respectively) will be killed before training begins.  Otherwise\n"
00224           "a square radius is used.");
00225   SETFN_DEFINE2(circular_lat_wts,fixed_arch_param_setfn2);
00226   
00227   PARAM_A(blackboard,"gammaaff",1.0,,
00228           "Scaling factor for the set of afferent connections.  For a LISSOM\n"
00229           "network (the only network supporting it as of this writing), this\n"
00230           "parameter makes the set overcomplete, but it can still be useful.\n"
00231           "If gammaaff is e.g. multiplied by a factor k, the result is the same\n"
00232           "as dividing all of gammaexc, gammainh, beta, and delta by that same\n"
00233           "factor k (assuming a linear sigmoidal function).");
00234   
00235   PARAM_A(blackboard,"gammasur",0.0,,
00236           "Scaling factor for the surround (actually the average afferent\n"
00237           "input).");
00238   
00239   PARAM_A(blackboard,"gammaexc",1.0,,
00240           "Scaling factor for excitatory lateral interactions.");
00241   
00242   PARAM_A(blackboard,"gammainh",1.0,,
00243           "Scaling factor for inhibitory lateral interactions.");
00244   
00245   PARAM_A(blackboard,"interactive",False,.add_lower_bound(False).add_upper_bound(True),
00246           "Whether this run is considered an interactive or a batch run;\n"  
00247           "affects certain behaviors such as how often progress messages\n"
00248           "are printed, what level of severity is required to exit the\n"  
00249           "program, whether to spawn viewers for images, etc.  The value\n"  
00250           "of this parameter is usually guessed appropriately, but if it is\n"  
00251           "not then the user can set it explicitly.");
00252   
00253   PARAM_A(blackboard,"normalize_aff",False,.add_lower_bound(False).add_upper_bound(True),
00254           "Whether or not to normalize afferent inputs.");
00255   /* it may be ok to change this parameter mid-stream */
00256   //SETFN_DEFINE2(normalize_aff,fixed_arch_param_setfn2); 
00257 
00258   PARAM_A(blackboard,"preset_lat_wts",True,.add_lower_bound(False).add_upper_bound(True),
00259           "Whether or not to preset the lateral weights.");
00260   SETFN_DEFINE2(preset_lat_wts,fixed_arch_param_setfn2);
00261   
00262   PARAM_A(blackboard,"retina_edge_buffer",0,.add_lower_bound(0),
00263           "Number of retinal units to leave on all sides when determining the center\n"
00264           "of the afferent receptive field of each neuron.  If it is zero, then the\n"
00265           "entire cortex is scaled to the entire retina, but then the neurons near\n"
00266           "the border will have only partial receptive fields.  An effectively\n"
00267           "infinite retina, where each neuron will have a complete receptive field,\n"
00268           "can be obtained by setting this parameter to rf_radius+randomness*RN/2.\n"
00269           "This maps the cortex to a smaller square region (width and length\n"
00270           "RN-2*retina_edge_buffer) in the center of the retina.  If you wish to\n"
00271           "keep the same cortical magnification factor as if there were no buffer,\n"
00272           "also increase RN by 2*retina_edge_buffer.");
00273   
00274   PARAM_A(blackboard,"running_remotely",False,.add_lower_bound(False).add_upper_bound(True),
00275           "Allows the user to declare that the program is being run in a remote shell,\n"  
00276           "which affects default values for whether image viewers are spawned, etc.");
00277 
00278   PARAM_A(blackboard,"spawn_viewer",Uninitialized,.add_lower_bound(Uninitialized).add_upper_bound(True),
00279           "Whether to spawn external programs to view images when they are\n"
00280           "created.  Uninitialized means to guess whether that's appropriate, based on\n"
00281           "the values of `interactive' and `running_remotely'.");
00282 
00283   PARAM_A(blackboard,"tsettle",10,.add_lower_bound(1),
00284           "Iterations for activity to settle at each input presentation.  The total\n"
00285           "duration of these is only the equivalent of a few seconds in real time,\n"
00286           "as opposed to the LISSOM training iterations, which total to the equivalent\n"
00287           "of days or weeks.  The first settling iteration (1) refers to the response\n"
00288           "to the input only (through the afferent weights);  subsequent settling\n"
00289           "iterations include the lateral weights."); 
00290 
00291 
00292 
00293   PARAM_A(blackboard,"alpha_exc",0.002,.add_lower_bound(0.0),
00294           "Learning rate for excitatory lateral connections.");
00295   
00296   PARAM_A(blackboard,"alpha_inh",0.0002,.add_lower_bound(0.0),
00297           "Learning rate for inhibitory lateral connections.");
00298   
00299   PARAM_A(blackboard,"alpha_input",0.0007,.add_lower_bound(0.0),
00300           "Learning rate for afferent connections.");
00301 
00302   PARAM_A(blackboard,"allow_negative_wts",False,.add_lower_bound(False).add_upper_bound(True),
00303           "Ordinarily, all live weights in LISSOM are positive, and dead weights are\n"
00304           "set to a small negative value to mark them as dead.  If this parameter is\n"
00305           "set to True, weights are allowed to become negative, but no weights\n"
00306           "are allowed to become dead.  At present, this option is experimental,\n"
00307           "and primarily for testing.");
00308 
00309   PARAM_A(blackboard,"beta",0.7,,
00310           "Upper threshold of sigmoid-like activation function.");
00311 
00312   PARAM_A(blackboard,"delta",0.1,,
00313           "Lower threshold of sigmoid-like activation function.");
00314   
00315   PARAM_A(blackboard,"dynamics",False,.add_lower_bound(False).add_upper_bound(True),
00316           "Whether to use continuous learning dynamics:\n"
00317           " False=discrete (learn after each presentation, i.e. when settling completes),\n"
00318           " True =continuous (learn after each settling step.\n"
00319           "(Should be called continuousdynamics for clarity; the name is a legacy.");
00320   
00321   PARAM_A(blackboard,"divide_input_sum",False,.add_lower_bound(False).add_upper_bound(True),
00322           "Whether to divide input_response values by the average of the input receptors;\n"
00323           "when true you will need a different gammaaff to compensate.");
00324   
00325   PARAM_A(blackboard,"divide_input_sum_offset",0.0,,
00326           "When divide_input_sum is True, constant to add to the input response before\n"
00327           "the division.  Should be non-zero, since if it is zero the response will be\n"
00328           "subject to the iceberg effect -- very low contrasts will be boosted to levels\n"
00329           "much higher than moderate contrasts, because the low contrast will activate\n"
00330           "only the center of the RF, and none of the surround.  (Another interpretation:\n"
00331           "the constant reduces divide-by-nearly-zero errors).");
00332   
00333   PARAM_A(blackboard,"divide_reference_sum",False,.add_lower_bound(False).add_upper_bound(True),
00334           "Same as divide_input_sum, except that instead of dividing by the average\n"
00335           "input value, divides by the dot product of the receptive field and the initial\n"
00336           "set of weights that would have been generated if preset_aff_wts were true.");
00337   
00338   PARAM_A(blackboard,"divide_input_sum_offset",0.0,,
00339           "When divide_input_sum is True, constant to add to the input response before\n"
00340           "the division.  Should be non-zero, since if it is zero the response will be\n"
00341           "subject to the iceberg effect -- very low contrasts will be boosted to levels\n"
00342           "much higher than moderate contrasts, because the low contrast will activate\n"
00343           "only the center of the RF, and none of the surround.");
00344   
00345   PARAM_A(blackboard,"divide_input_sum_scale",1.0,,
00346           "When divide_input_sum is True, constant by which to multiply the input\n"
00347           "response before the division.");
00348 
00349   PARAM_A(blackboard,"lateral_sign_type",Uninitialized,,
00350           "For long-range inhibitory connections, how the sign and magnitude of the\n"
00351           "gammainh are determined.  Options:\n"
00352           "  Uninitialized: gammainh is used as-is with a fixed negative sign.\n"
00353           "  False:         gammainh and lateral_sign_offset are scaled\n"
00354           "                 by the strength of the incoming inhibitory activations.\n"
00355           "  True:          gammainh and lateral_sign_offset are scaled\n"
00356           "                 by the strength of the current input response.");
00357   
00358   PARAM_A(blackboard,"lateral_sign_scale",0.0,,
00359           "Untested.  Scales LISSOM map long-range inhibition by the initial\n"
00360           "(afferent) response to the input or by the current sum of the inhibitory\n"
00361           "input.");
00362   
00363   PARAM_A(blackboard,"lateral_sign_offset",-1.0,,
00364           "Untested.  Offset added to the lateral_sign_scale term.");
00365   
00366   PARAM_A(blackboard,"exc_death",0.0,.add_lower_bound(0.0),
00367           "Maximum value of excitatory lateral connection weights to kill when pruning.");
00368   
00369   PARAM_A(blackboard,"inh_death",0.00001,.add_lower_bound(0.),
00370           "Maximum value of inhibitory lateral connection weights to kill when pruning.");
00371   
00372   PARAM_A(blackboard,"lat_exc_randomness",1.0,.add_lower_bound(0.0).add_upper_bound(1.0),
00373           "Randomness radius of lateral excitatory connections.");
00374   
00375   PARAM_A(blackboard,"lat_inh_randomness",1.0,.add_lower_bound(0.0).add_upper_bound(1.0),
00376           "Randomness radius of lateral inhibitory connections.");
00377   
00378   PARAM_A(blackboard,"force_matching_initial_weights",True,.add_lower_bound(False).add_upper_bound(True),
00379           "If true, initial weights are forced to match between different regions of the\n"
00380           "same size.  Useful for e.g. ocular dominance simulations, to ensure that the\n"
00381           "outcome does not require differences in starting values to develop differences\n"
00382           "in the final result through symmetry breaking.");
00383   SETFN_DEFINE2(force_matching_initial_weights,fixed_arch_param_setfn2);
00384 
00385   PARAM_A(blackboard,"noise",0.0,.add_lower_bound(0.0).add_upper_bound(1.0),
00386           "Intrinsic noise factor of the neuron.");
00387   
00388   PARAM_A(blackboard,"preset_aff_wts",True,.add_lower_bound(False).add_upper_bound(True),
00389           "Whether or not to use preset afferent weights."); 
00390   SETFN_DEFINE2(preset_aff_wts,fixed_arch_param_setfn2);
00391 
00392   PARAM_A(blackboard,"preset_sigma_aff",double(Uninitialized),.add_lower_bound(0.0),
00393           "Variance (sigma) of Gaussian to preset afferent weights.  It defaults to\n"
00394           "0.9*rf_radius, which makes it nearly fill up the available weight area.");
00395   params_define_default_expr("preset_sigma_aff","0.9*rf_radius");
00396 
00397   PARAM_A(blackboard,"preset_sigma_lat",double(Uninitialized),.add_lower_bound(double(Uninitialized)),
00398           "If this parameter is set, the default values for preset_sigma_exc and\n"
00399           "preset_sigma_inh are calculated from it as follows:\n\n"
00400           
00401           "   preset_sigma_exc = preset_sigma_lat\n"
00402           "   preset_sigma_inh = preset_sigma_lat*MIN(1,sqrt(inh_rad))\n\n"
00403           
00404           "This formula and the preset_sigma_lat parameter are used for backwards\n"
00405           "compatibility with old parameter files.  The normal default values for\n"
00406           "the two parameters listed are probably more appropriate, so it is better\n"
00407           "to avoid setting this parameter.");
00408 
00409   PARAM_A(blackboard,"preset_sigma_exc",double(Uninitialized),.add_lower_bound(double(Uninitialized)),
00410           "Variance (sigma) of Gaussian to preset lateral excitatory weights.  Unless\n"
00411           "preset_sigma_lat is set, it defaults to 0.9*exc_rad, which makes it nearly\n"
00412           "fill up the available weight area.");
00413 
00414   PARAM_A(blackboard,"preset_sigma_inh",double(Uninitialized),.add_lower_bound(double(Uninitialized)),
00415           "Variance (sigma) of Gaussian to preset lateral inhibitory weights.  Unless\n"
00416           "preset_sigma_lat is set, it defaults to 0.9*inh_rad, which makes it nearly\n"
00417           "fill up the available weight area.");
00418 
00419   PARAM_A(blackboard,"randomness",0.0,.add_lower_bound(0.0).add_upper_bound(1.0),
00420           "Amount of randomness of placement of receptive field centers for each neuron:\n"
00421           "0 = no randomness, 1 = offset by half of the width and height of the input\n"
00422           "region.  Large values of randomness are not likely to be useful, since they\n"
00423           "will result in many neurons having RFs cropped by the border of the input\n"
00424           "region.");
00425   
00426   PARAM_A(blackboard,"smooth_circular_outlines",False,.add_lower_bound(False).add_upper_bound(True),
00427           "If true, smooths the edges of circular sets of weights when they are\n"
00428           "initialized or when their size is changed.\n\n"
00429 
00430           "The outline of a weight radius (rf_radius, inh_rad, exc_rad, etc.) will\n"
00431           "inherently be jagged because of the underlying grid.  For small radii\n"
00432           "especially these jaggies can cause unwanted orientation artifacts, since\n"
00433           "some directions will have a slightly greater diameter than others.  To\n"
00434           "minimize this orientation bias in the initial weights, you can set this\n"
00435           "parameter to true.  The amount of smoothing can be controlled via\n"
00436           "smooth_circular_radius_trim.");
00437 
00438   PARAM_A(blackboard,"smooth_circular_radius_trim",-0.25,,
00439           "When smooth_circular_outlines is True, this quantity is added to the\n"
00440           "integer-truncated version of the appropriate radius (rf_radius,\n"
00441           "inh_rad, or exc_rad) to create a floating-point radius at which to\n"
00442           "start smoothing the outline.  The integer value of the radius plus\n"
00443           "this parameter should be less than the floating-point value\n"
00444           "of the radius; this parameter is often slightly negative.");
00445 
00446 
00447 #ifdef OBJ_LISSOM  
00448   PARAM_A(blackboard,"l2_norm",False,.add_lower_bound(False).add_upper_bound(True),
00449           "Usually, afferent input is not normalized, and afferent weights are\n"
00450           "normalized with an L1 norm.  If this option is enabled, afferent\n"
00451           "inputs will be normalized with an L2 norm, and for train_obj_weights\n"
00452           "afferent weights will be normalized with an L2 norm.  The regular\n"
00453           "regular learning routines in modify_weights could also be extended\n"
00454           "to support an L2 norm, but meanwhile this option is only likely to\n"
00455           "be useful for OBJ-LISSOM.");
00456 
00457   PARAM_A(blackboard,"alpha_settle",0.001,.add_lower_bound(0.0),
00458           "Settling rate for map activity (use with OBJ-LISSOM).");
00459   
00460   PARAM_A(blackboard,"asymptotic_wts",False,.add_lower_bound(False).add_upper_bound(True),
00461           "Whether or not to use asymptotically positive weights (use with OBJ-LISSOM).");
00462 
00463   PARAM_A(blackboard,"crop_negative_wts",True,.add_lower_bound(False).add_upper_bound(True),
00464           "Whether to crop negative afferent weights or not (use with OBJ-LISSOM).");
00465 
00466   PARAM_A(blackboard,"obj_lateral_on",True,.add_lower_bound(False).add_upper_bound(True),
00467           "Whether or not to add lateral terms in OBJ-LISSOM activity update."); 
00468 #endif /* OBJ_LISSOM */
00469 
00470 }
00471 
00472 
00473 
00474 
00475 /******************************************************************************/
00476 /* LISSOM functions                                                           */
00477 /******************************************************************************/
00478 
00479 cmdstat cmd_save_params( CMD_ARGS )
00480 {
00481   CMD_ARG_PARAMS(save_params);
00482   string dummy;
00483   const string default_filename = p.parse("${filebase}.${06iteration}.params",dummy);
00484   const string filename = arglist.next(default_filename);  
00485   return cmdparam_save_current_state(filename.c_str());
00486 }
00487 
00488 
00489 cmdstat fixed_arch_param_setfn2(const string& name, Typeless& existing, const Typeless& requested)
00490 {
00491   if (!network_initialized)
00492     existing.set(requested);
00493   else  if (existing != requested) {
00494     ipc_notify(IPC_ONE,IPC_ERROR,"Can't change %s once the network has been initialized; call uninit_network first",
00495                name.c_str());
00496     return CMD_PARAMETER_ERROR;
00497   }
00498   
00499   return CMD_NO_ERROR;
00500 }
00501 
00502 
00503 
00504 cmdstat read_only_param_setfn2(const string& name, Typeless&, const Typeless&)
00505 {
00506   ipc_notify(IPC_ONE,IPC_ERROR,"Read-only parameter; can't change %s",name.c_str());
00507   return CMD_PARAMETER_ERROR;
00508 }
00509 
00510 
00511 
00512 /******************************************************************************/
00513 /* Wrappers for obsolete legacy functions; to be removed eventually           */
00514 /******************************************************************************/
00515 
00516 cmdstat cmd_plot_activity( CMD_ARGS )
00517 {
00518   CMD_ARG_ASSERT_UNUSED;
00519   return cmddefs_exec_str("plot Activity");
00520 }
00521 
00522 
00523 
00524 cmdstat cmd_plot_afferent_weight_map( CMD_ARGS )
00525 {
00526   CMD_ARG_ASSERT_UNUSED;
00527   return cmddefs_exec_str("plot_unit_range");
00528 }
00529 
00530 
00531 
00532 cmdstat cmd_plot_weights( CMD_ARGS )
00533 {
00534   CMD_ARG_PARAMS(plot_weights);
00535 
00536   string command = "plot_unit";
00537   for (; (!arglist.empty()); ) {
00538     if (arglist.oneremaining()) {
00539       ipc_notify(IPC_ONE,IPC_ERROR,"Wrong number of arguments to plot_weights");
00540       return CMD_PARAMETER_ERROR;
00541     }
00542 
00543     // Swaps order to match reversed conventions used historically
00544     const string ui=arglist.next(string());
00545     const string uj=arglist.next(string());
00546     command += " " + uj + " " + ui; 
00547   }
00548 
00549   CMD_ARG_ASSERT_EMPTY;
00550   return cmddefs_exec_str(command.c_str());
00551 }
00552 
00553 
00555 cmdstat cmd_measure_od_pref( CMD_ARGS ) 
00556 {
00557   CMD_ARG_ASSERT_UNUSED;
00558   return (cmddefs_exec_str("call measure_od_pref")<CMD_NO_ERROR ||
00559           cmddefs_exec_str("plot OcularPreference"));
00560 }
00561 
00562 
00563 
00564 cmdstat cmd_measure_or_pref( CMD_ARGS ) 
00565 {
00566   CMD_ARG_ASSERT_UNUSED;
00567   return (cmddefs_exec_str("call measure_or_pref")<CMD_NO_ERROR ||
00568           cmddefs_exec_str("plot OrientationPreference"));
00569 }
00570 
00571 
00572 
00573 cmdstat cmd_plot_or_pref( CMD_ARGS )
00574 {
00575   CMD_ARG_PARAMS(plot_or_pref);
00576 
00577   // Ignores all arguments except the filename
00578   arglist.next(string(""));
00579   arglist.next(string(""));
00580 
00581   const string filename   = arglist.next(string());
00582   const string name_fmt   = (filename==string() ? string("${filebase}.${06iteration}.or") :
00583                              (filename[0]=='.' && (filename.length()>1) && isalnum(filename[1])?
00584                               ("${filebase}" + filename) :
00585                               filename));
00586   const string command    = "plot filename_format=" + name_fmt + " OrientationPreference";
00587   
00588   CMD_ARG_ASSERT_EMPTY;
00589   return cmddefs_exec_str(command.c_str());
00590 }
00591 
00592 
00593 
00594 cmdstat cmd_plot_od_pref( CMD_ARGS )
00595 {
00596   CMD_ARG_PARAMS(plot_od_pref);
00597 
00598   // Ignores first two arguments
00599   arglist.next(string(""));
00600   arglist.next(string(""));
00601 
00602   const string filename   = arglist.next(string());
00603   const string name_fmt   = (filename==string() ? string("${filebase}.${06iteration}.od") :
00604                              (filename[0]=='.' && (filename.length()>1) && isalnum(filename[1])?
00605                               ("${filebase}" + filename) :
00606                               filename));
00607   const string command    = "plot filename_format=" + name_fmt + " OcularPreference";
00608   CMD_ARG_ASSERT_EMPTY;
00609   return cmddefs_exec_str(command.c_str());
00610 }
00611 
00612 
00613 
00614 cmdstat cmd_OR_features( CMD_UNUSED_ARGS ) 
00615 {
00616   ipc_notify(IPC_ONE,IPC_WARNING, "OR_features is not currently implemented; ignored");
00617   return CMD_MISC_ERROR;
00618 }
00619 
00620 
00621 cmdstat cmd_OD_features( CMD_UNUSED_ARGS )
00622 {
00623   ipc_notify(IPC_ONE,IPC_WARNING, "OD_features is not currently implemented; ignored");
00624   return CMD_MISC_ERROR;
00625 }
00626 
00627 
00628 

Generated on Mon Jan 20 02:35:44 2003 for RF-LISSOM by doxygen1.3-rc2