Skip to content

Implement HTFA parameter support: n_levels, backend, random_state #91

@jeremymanning

Description

@jeremymanning

Description

The current HTFA implementation is missing several expected parameters that are tested in the disabled test suite.

Missing Parameters

  • n_levels - Control number of hierarchical levels (currently assumes 2)
  • backend - Support for different computational backends (NumPy, JAX, PyTorch)
  • random_state - Ensure reproducible results
  • max_iter - Control maximum iterations for convergence

Expected Behavior

# Should work:
model = HTFA(n_factors=5, n_levels=3, backend="numpy", random_state=42, max_iter=100)

Current Status

These parameters cause TypeError: unexpected keyword argument errors.

Tests to Re-enable

When this is implemented, re-enable the following tests in tests/test_htfa_core.py.disabled:

  • test_htfa_initialization
  • test_htfa_different_levels
  • test_htfa_reproducibility
  • test_invalid_backend
  • All parametrized tests using n_levels

Implementation Notes

  • Backend support should start with NumPy and be extensible
  • n_levels=1 should work like standard factor analysis
  • Random state should control all random operations for reproducibility

Related Files

  • htfa/core/htfa.py - Main implementation
  • tests/test_htfa_core.py.disabled - Tests to re-enable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions