bmtk.simulator.dpointnet.loss_functions package#
Submodules#
bmtk.simulator.dpointnet.loss_functions.loss_utils module#
- bmtk.simulator.dpointnet.loss_functions.loss_utils.compute_spike_rate_distribution_loss(_rates, target_rate, dtype=tensorflow.float32)[source]#
- bmtk.simulator.dpointnet.loss_functions.loss_utils.compute_spike_rate_target_loss(rates, target_rates, dtype=tensorflow.float32)[source]#
- bmtk.simulator.dpointnet.loss_functions.loss_utils.get_pop_names(network, core_radius=None, n_selected_neurons=None, data_dir='', return_node_type_ids=False)[source]#
- bmtk.simulator.dpointnet.loss_functions.loss_utils.get_population_neuron_ids(network, data_dir='GLIF_network', core_mask=None, reindex_selected=False)[source]#
- bmtk.simulator.dpointnet.loss_functions.loss_utils.get_tuning_angles(network, data_dir='')[source]#
Per-neuron preferred orientation (degrees) in the model’s node order.
Mirrors get_pop_names’ data_dir resolution and isolate_core_neurons’ native-order handling: dpointnet keeps the SONATA file order (no ‘tf_id_to_bmtk_id’ reindexing), so the file order is the model order unless the reference reordering map is present.
- bmtk.simulator.dpointnet.loss_functions.loss_utils.huber_quantile_loss(u, tau, kappa, dtype=tensorflow.float32)[source]#
- bmtk.simulator.dpointnet.loss_functions.loss_utils.isolate_core_neurons(network, radius=None, n_selected_neurons=None, data_dir='GLIF_network')[source]#
- bmtk.simulator.dpointnet.loss_functions.loss_utils.neuropixels_cell_type_to_cell_type(pop_name)[source]#
- bmtk.simulator.dpointnet.loss_functions.loss_utils.pop_name_to_cell_type(pop_name, ignore_l5e_subtypes=False)[source]#
convert pop_name in the old format to cell types. for example, ‘e4Rorb’ -> ‘L4 Exc’ ‘i4Pvalb’ -> ‘L4 PV’ ‘i23Sst’ -> ‘L2/3 SST’ ‘e5ET’ -> ‘L5 ET’
- bmtk.simulator.dpointnet.loss_functions.loss_utils.resolve_core_mask(network, core_mask=None, core_radius=None, data_dir='GLIF_network')[source]#
Resolve a boolean core mask for a loss function.
If an explicit
core_maskis given it is used as-is. Otherwise, if acore_radiusis given, the central-core mask is computed from neuron positions (sqrt(x^2+z^2)<radius), matching the reference V1_GLIF_model’sloss_core_radius. ReturnsNoneif neither is provided (loss applies to all neurons).
bmtk.simulator.dpointnet.loss_functions.orientation_selectivity_loss module#
- class bmtk.simulator.dpointnet.loss_functions.orientation_selectivity_loss.OrientationSelectivityLoss(rnn, osi_cost=20.0, pre_delay=None, post_delay=None, dtype=tensorflow.float32, core_mask=None, method='crowd_osi', subtraction_ratio=1.0, layer_info=None, data_dir='GLIF_network', neuropixels_df='Neuropixels_data/v1_OSI_DSI_DF.csv', ema_decay=0.95, use_ema_normalizer=True, annulus_loss_weight=0.0, **kwargs)[source]#
Bases:
object- get_neuropixels_osi_dsi(selection_mask=None)[source]#
Processes neuropixels data to obtain neurons average firing rates.
- Returns:
dict: Dictionary containing rates and node_type_ids for each population query.
- property uses_ema_normalizer#
bmtk.simulator.dpointnet.loss_functions.spike_rate_distribution_target module#
- class bmtk.simulator.dpointnet.loss_functions.spike_rate_distribution_target.SpikeRateDistributionTarget(rnn, stimulus_type='drifting_gratings', rate_cost=0.5, pre_delay=None, post_delay=None, data_dir='GLIF_network', core_mask=None, rates_dampening=1.0, seed=42, dtype=tensorflow.float32, neuropixels_df=None, annulus_loss_weight=0.0, **kwargs)[source]#
Bases:
object
bmtk.simulator.dpointnet.loss_functions.synchronization_loss module#
bmtk.simulator.dpointnet.loss_functions.target_firing_rates module#
- class bmtk.simulator.dpointnet.loss_functions.target_firing_rates.TargetFiringRate(rnn, firing_rate, **kwargs)[source]#
Bases:
object
bmtk.simulator.dpointnet.loss_functions.voltage_regularization module#
bmtk.simulator.dpointnet.loss_functions.weight_regularization module#
- class bmtk.simulator.dpointnet.loss_functions.weight_regularization.EMDWeightRegularization(rnn, cost=10.0, data_dir='', dtype=None, **kwargs)[source]#
Bases:
objectEarth Mover’s Distance (Wasserstein-1) regularizer on the recurrent weights.
Penalizes the per-connection-type EMD between the current and initial recurrent synaptic weight distributions, averaged over all connection types. Because the initial distribution is captured at construction, the loss is exactly 0 at init. Ported from V1_GLIF_model loss_functions.EarthMoversDistanceRegularizer.