MCPcopy Create free account
hub / github.com/BindsNET/bindsnet / __init__

Method __init__

bindsnet/network/topology_features.py:366–416  ·  view source on GitHub ↗

Will run a bernoulli trial using :code:`value` to determine if a signal will successfully traverse the synapse :param name: Name of the feature :param value: Number(s) in [0, 1] which represent the probability of a signal traversing a synapse. Tensor values assum

(
        self,
        name: str,
        value: Union[torch.Tensor, float, int] = None,
        value_dtype: torch.dtype = torch.float32,
        range: Optional[Sequence[float]] = None,
        norm: Optional[Union[torch.Tensor, float, int]] = None,
        learning_rule: Optional[bindsnet.learning.LearningRule] = None,
        nu: Optional[Union[list, tuple]] = None,
        reduction: Optional[callable] = None,
        decay: float = 0.0,
        parent_feature=None,
        sparse: Optional[bool] = False,
        batch_size: int = 1,
    )

Source from the content-addressed store, hash-verified

364
365class Probability(AbstractFeature):
366 def __init__(
367 self,
368 name: str,
369 value: Union[torch.Tensor, float, int] = None,
370 value_dtype: torch.dtype = torch.float32,
371 range: Optional[Sequence[float]] = None,
372 norm: Optional[Union[torch.Tensor, float, int]] = None,
373 learning_rule: Optional[bindsnet.learning.LearningRule] = None,
374 nu: Optional[Union[list, tuple]] = None,
375 reduction: Optional[callable] = None,
376 decay: float = 0.0,
377 parent_feature=None,
378 sparse: Optional[bool] = False,
379 batch_size: int = 1,
380 ) -> None:
381 # language=rst
382 """
383 Will run a bernoulli trial using :code:`value` to determine if a signal will successfully traverse the synapse
384 :param name: Name of the feature
385 :param value: Number(s) in [0, 1] which represent the probability of a signal traversing a synapse. Tensor values
386 assume that probabilities will be matched to adjacent synapses in the connection. Scalars will be applied to
387 all synapses.
388 :param value_dtype: Data type for :code:`value` tensor
389 :param range: Range of acceptable values for the :code:`value` parameter. Should be in [0, 1]
390 :param norm: Value which all values in :code:`value` will sum to. Normalization of values occurs after each sample
391 and after the value has been updated by the learning rule (if there is one)
392 :param learning_rule: Rule which will modify the :code:`value` after each sample
393 :param nu: Learning rate for the learning rule
394 :param reduction: Method for reducing parameter updates along the minibatch
395 dimension
396 :param decay: Constant multiple to decay weights by on each iteration
397 :param parent_feature: Parent feature to inherit :code:`value` from
398 :param sparse: Should :code:`value` parameter be sparse tensor or not
399 :param batch_size: Mini-batch size.
400 """
401
402 ### Assertions ###
403 super().__init__(
404 name=name,
405 value=value,
406 value_dtype=value_dtype,
407 range=[0, 1] if range is None else range,
408 norm=norm,
409 learning_rule=learning_rule,
410 nu=nu,
411 reduction=reduction,
412 decay=decay,
413 parent_feature=parent_feature,
414 sparse=sparse,
415 batch_size=batch_size,
416 )
417
418 def sparse_bernoulli(self):
419 values = torch.bernoulli(self.value.values())

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected