diff --git a/stepmix/emission/emission.py b/stepmix/emission/emission.py index 35497fd..d34537e 100644 --- a/stepmix/emission/emission.py +++ b/stepmix/emission/emission.py @@ -179,7 +179,7 @@ def permute_classes(self, perm): self.parameters[key] = item[perm] def print_parameters( - self, indent=1, feature_names=None, index=["param", "class_no"], model_name=None + self, indent=1, feature_names=None, index=["param", "variable"], columns=["model_name", "class_no"], model_name=None ): """Print parameters with nice formatting. @@ -195,6 +195,8 @@ def print_parameters( Variable names. index: List of str Column names in self.get_parameters_df to use as index in the displayed dataframe. + columns: List of str + Column names in self.get_parameters_df to use as columns in the displayed dataframe. model_name: str str to display as model name. """ @@ -203,7 +205,7 @@ def print_parameters( if model_name is not None: df["model_name"] = model_name df = pd.pivot_table( - df, index=index, columns=["model_name", "variable"], values="value" + df, index=index, columns=columns, values="value" ) print( indent_string + df.round(4).to_string().replace("\n", "\n" + indent_string) diff --git a/stepmix/emission/gaussian.py b/stepmix/emission/gaussian.py index 483ae7d..d433e14 100644 --- a/stepmix/emission/gaussian.py +++ b/stepmix/emission/gaussian.py @@ -200,11 +200,11 @@ def __init__(self, **kwargs): self.model_str = "gaussian_full" def print_parameters( - self, indent=1, feature_names=None, index=["class_no", "param"] + self, indent=1, feature_names=None, index=["class_no", "param"], columns=["model_name", "variable"] ): - """Flipping class_no and index is nicer for full covariances.""" + """Flipping class_no and variable is nicer for full covariances.""" super().print_parameters( - indent=indent, feature_names=feature_names, index=index + indent=indent, feature_names=feature_names, index=index, columns=columns ) def get_parameters_df(self, feature_names=None): @@ -267,11 +267,11 @@ def __init__(self, **kwargs): self.model_str = "gaussian_tied" def print_parameters( - self, indent=1, feature_names=None, index=["class_no", "param"] + self, indent=1, feature_names=None, index=["class_no", "param"], columns=["model_name", "variable"] ): - """Flipping class_no and index is nicer for full covariances.""" + """Flipping class_no and variable is nicer for full covariances.""" super().print_parameters( - indent=indent, feature_names=feature_names, index=index + indent=indent, feature_names=feature_names, index=index, columns=columns ) def get_parameters_df(self, feature_names=None):