haam.haam_bws module

HAAM with BWS (Best-Worst Scaling) Support

A specialized HAAM class for analyzing interpretable BWS features while maintaining compatibility with standard HAAM visualizations.

class haam.haam_bws.HAAMwithBWS(criterion: ndarray | Series | list, ai_judgment: ndarray | Series | list, human_judgment: ndarray | Series | list, bws_features: ndarray | DataFrame, feature_names: List[str] | None = None, texts: List[str] | None = None, standardize: bool = True, sample_split_post_lasso: bool = True, auto_run: bool = True, random_state: int = 42)[source]

Bases: object

HAAM analysis for Best-Worst Scaling (BWS) or other interpretable features.

This class provides HAAM analysis capabilities for pre-computed interpretable features, bypassing PCA while maintaining all statistical analysis and visualization capabilities of standard HAAM.

Parameters:
  • criterion (array-like) – Ground truth variable (e.g., social class)

  • ai_judgment (array-like) – AI predictions/ratings

  • human_judgment (array-like) – Human ratings

  • bws_features (array-like) – Pre-computed interpretable features (e.g., BWS scores) Shape: (n_samples, n_features)

  • feature_names (list, optional) – Names for each BWS feature for interpretability

  • texts (list of str, optional) – Original texts (for supplementary analysis)

  • standardize (bool, default=True) – Whether to standardize features before analysis

  • sample_split_post_lasso (bool, default=True) – Whether to use sample splitting for post-LASSO inference True: Conservative inference with valid p-values False: Maximum power but potential selection bias

  • auto_run (bool, default=True) – Whether to automatically run the full pipeline

  • random_state (int, default=42) – Random seed for reproducibility

Methods

export_results([output_dir])

Export results to files.

run_analysis()

Run the complete HAAM analysis pipeline with BWS features.

__init__(criterion: ndarray | Series | list, ai_judgment: ndarray | Series | list, human_judgment: ndarray | Series | list, bws_features: ndarray | DataFrame, feature_names: List[str] | None = None, texts: List[str] | None = None, standardize: bool = True, sample_split_post_lasso: bool = True, auto_run: bool = True, random_state: int = 42)[source]
run_analysis()[source]

Run the complete HAAM analysis pipeline with BWS features.

export_results(output_dir: str = '.')[source]

Export results to files.