Skip to content

Commit

Permalink
simplify if else conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
LegrandNico committed Aug 9, 2024
1 parent c8a8020 commit 446e85a
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 315 deletions.
8 changes: 4 additions & 4 deletions src/pyhgf/model/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def add_nodes(
value_parents: Optional[Union[List, Tuple, int]] = None,
volatility_children: Optional[Union[List, Tuple, int]] = None,
volatility_parents: Optional[Union[List, Tuple, int]] = None,
coupling_funct: Optional[Tuple[Callable, ...]] = None,
coupling_fn: Tuple[Optional[Callable], ...] = (None,),
**additional_parameters,
):
"""Add new input/state node(s) to the neural network.
Expand Down Expand Up @@ -398,8 +398,8 @@ def add_nodes(
integer or a list of integers, in case of multiple children. The coupling
strength can be controlled by passing a tuple, where the first item is the
list of indexes, and the second item is the list of coupling strengths.
coupling_funct :
Coupling function between the current node and its value children.
coupling_fn :
Coupling function(s) between the current node and its value children.
It has to be provided as a tuple. If multiple value children are specified,
the coupling functions must be stated in the same order of the children.
Note: if a node has multiple parents nodes with different coupling
Expand Down Expand Up @@ -650,7 +650,7 @@ def add_nodes(
# add a new edge
edges_as_list.append(
AdjacencyLists(
node_type, None, None, None, None, coupling_funct=coupling_funct
node_type, None, None, None, None, coupling_fn=coupling_fn
)
)

Expand Down
5 changes: 4 additions & 1 deletion src/pyhgf/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ class AdjacencyLists(NamedTuple):
mean and unknown variance.
* 4: Dirichlet Process state node.
The variable `coupling_fn` list the coupling functions between this nodes and the
children nodes. If `None` is provided, a linear coupling is assumed.
"""

node_type: int
value_parents: Optional[Tuple]
volatility_parents: Optional[Tuple]
value_children: Optional[Tuple]
volatility_children: Optional[Tuple]
coupling_funct: Optional[Tuple[Callable, ...]] = None
coupling_fn: Tuple[Optional[Callable], ...]


class Inputs(NamedTuple):
Expand Down
Loading

0 comments on commit 446e85a

Please sign in to comment.