ContextLab / ContextLab/htfa

Implement HTFA parameter support: n_levels, backend, random_state

Open
#91 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## 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
```python
# 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.