diff --git a/src/pyhgf/model/hgf.py b/src/pyhgf/model/hgf.py index 74746de1..964e92d6 100644 --- a/src/pyhgf/model/hgf.py +++ b/src/pyhgf/model/hgf.py @@ -28,8 +28,6 @@ class HGF(Network): strength with children and parents (i.e. `"value_coupling_parents"`, `"value_coupling_children"`, `"volatility_coupling_parents"`, `"volatility_coupling_children"`). - verbose : bool - Verbosity level. """ @@ -62,7 +60,6 @@ def __init__( "2": 0.0, "3": 0.0, }, - verbose: bool = True, ) -> None: r"""Parameterization of the HGF model. @@ -107,27 +104,15 @@ def __init__( A dictionary containing the initial values for the tonic drift at different levels of the hierarchy. This represents the drift of the random walk. Defaults set all entries to `0.0` (no drift). - verbose : - The verbosity of the methods for model creation and fitting. Defaults to - `True`. """ - self.verbose = verbose Network.__init__(self) self.model_type = model_type self.n_levels = n_levels if model_type not in ["continuous", "binary"]: - if self.verbose: - print("Initializing a network with custom node structure.") + raise ValueError("Invalid model type.") else: - if self.verbose: - print( - ( - f"Creating a {self.model_type} Hierarchical Gaussian Filter " - f"with {self.n_levels} levels." - ) - ) if model_type == "continuous": # Input self.add_nodes( diff --git a/src/pyhgf/model/network.py b/src/pyhgf/model/network.py index b0e85b2d..80239853 100644 --- a/src/pyhgf/model/network.py +++ b/src/pyhgf/model/network.py @@ -65,7 +65,6 @@ def __init__(self) -> None: self.update_sequence: Optional[UpdateSequence] = None self.scan_fn: Optional[Callable] = None self.inputs: Inputs - self.verbose: bool = False def create_belief_propagation_fn(self, overwrite: bool = True) -> "Network": """Create the belief propagation function. @@ -88,8 +87,6 @@ def create_belief_propagation_fn(self, overwrite: bool = True) -> "Network": # create the update sequence if it does not already exist if self.update_sequence is None: self.set_update_sequence() - if self.verbose: - print("... Create the update sequence from the network structure.") # create the belief propagation function # this function is used by scan to loop over observations @@ -99,8 +96,6 @@ def create_belief_propagation_fn(self, overwrite: bool = True) -> "Network": update_sequence=self.update_sequence, structure=self.structure, ) - if self.verbose: - print("... Create the belief propagation function.") else: if overwrite: self.scan_fn = Partial( @@ -108,11 +103,6 @@ def create_belief_propagation_fn(self, overwrite: bool = True) -> "Network": update_sequence=self.update_sequence, structure=self.structure, ) - if self.verbose: - print("... Create the belief propagation function (overwrite).") - else: - if self.verbose: - print("... The belief propagation function is already defined.") return self @@ -138,8 +128,6 @@ def cache_belief_propagation_fn(self) -> "Network": jnp.ones((1, 1)), ), ) - if self.verbose: - print("... Cache the belief propagation function.") return self @@ -175,8 +163,6 @@ def input_data( """ if self.scan_fn is None: self = self.create_belief_propagation_fn() - if self.verbose: - print((f"Adding {len(input_data)} new observations.")) if time_steps is None: time_steps = np.ones((len(input_data), 1)) # time steps vector else: @@ -247,8 +233,6 @@ def input_custom_sequence( missing in the event log, or rejected trials). """ - if self.verbose: - print((f"Adding {len(input_data)} new observations.")) if time_steps is None: time_steps = np.ones(len(input_data)) # time steps vector diff --git a/tests/test_categorical.py b/tests/test_categorical.py index e08eafc0..f62cd593 100644 --- a/tests/test_categorical.py +++ b/tests/test_categorical.py @@ -2,7 +2,7 @@ import numpy as np -from pyhgf.model import HGF +from pyhgf.model import Network def test_categorical_state_node(): @@ -13,7 +13,7 @@ def test_categorical_state_node(): input_data = np.vstack([[0.0] * input_data.shape[1], input_data]) # create the categorical HGF - categorical_hgf = HGF(model_type=None, verbose=False).add_nodes( + categorical_hgf = Network().add_nodes( kind="categorical-input", node_parameters={ "n_categories": 3, diff --git a/tests/test_model.py b/tests/test_model.py index ee50f758..386c6167 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -4,7 +4,7 @@ import numpy as np from pyhgf import load_data -from pyhgf.model import HGF +from pyhgf.model import HGF, Network from pyhgf.response import total_gaussian_surprise @@ -16,7 +16,7 @@ def test_HGF(): ##################### custom_hgf = ( - HGF(model_type=None) + Network() .add_nodes(kind="continuous-input") .add_nodes(kind="binary-input") .add_nodes(value_children=0) diff --git a/tests/test_plots.py b/tests/test_plots.py index 24956207..d6551c0e 100644 --- a/tests/test_plots.py +++ b/tests/test_plots.py @@ -4,7 +4,7 @@ import numpy as np from pyhgf import load_data -from pyhgf.model import HGF +from pyhgf.model import HGF, Network def test_plotting_functions(): @@ -137,7 +137,7 @@ def test_plotting_functions(): input_data = np.vstack([[0.0] * input_data.shape[1], input_data]) # create the categorical HGF - categorical_hgf = HGF(model_type=None, verbose=False).add_nodes( + categorical_hgf = Network().add_nodes( kind="categorical-input", node_parameters={ "n_categories": 3,