Skip to content

Conversation

@cpaniaguam
Copy link
Collaborator

@cpaniaguam cpaniaguam commented Dec 12, 2025

This PR introduces the RLSSMConfig class, a specialized configuration class for Reinforcement Learning Sequential Sampling Models (RLSSM) that inherits from the newly created BaseModelConfig abstract base class (#860).

Key Features

RLSSMConfig Class

  • Inherits from BaseModelConfig: Leverages the common configuration interface while adding RLSSM-specific functionality
  • RLSSM-specific fields:
    • params_default: List of default parameter values (matches list_params order)
    • decision_process: Reference to the decision model (e.g., "LAN")
    • learning_process: Dictionary of learning functions for computed parameters
    • n_params, n_extra_fields: Validation counts for parameter consistency
    • decision_model, lan_model: Additional metadata for RLSSM models

Methods

  • from_rlssm_dict(): Factory method to create configs from existing RLSSM dictionary structures
  • validate(): Comprehensive validation ensuring parameter counts, bounds, and required fields are consistent
  • get_defaults(): Returns default values and bounds for parameters (returns float instead of ParamSpec)
  • to_config(): Converts RLSSMConfig to standard Config for backward compatibility
  • data property: Alias for response field to support both naming conventions

Key Differences from Standard Config

  • Uses params_default (list) instead of default_priors (dict) to match RLSSM parameter ordering
  • Supports hierarchical structure with separate decision and learning processes
  • Returns numeric defaults rather than prior distributions
  • Validates consistency between parameter lists and counts

Testing

  • Added 25 comprehensive tests in test_rlssm_config.py
  • 100% coverage of RLSSMConfig class
  • Tests cover creation, validation, defaults, conversion, and data alias functionality

Usage Example

from hssm.config import RLSSMConfig

# Create from dictionary (matching rlssm_model_config_list structure)
config = RLSSMConfig.from_rlssm_dict("rlwm", {
    "name": "rlwm",
    "description": "RLWM model with collapsing bound decision process",
    "n_params": 4,
    "n_extra_fields": 3,
    "list_params": ["alpha", "beta", "v", "a"],
    "extra_fields": ["participant_id", "trial_id", "feedback"],
    "params_default": [0.5, 0.3, 1.0, 1.5],
    "bounds": {
        "alpha": (0.0, 1.0),
        "beta": (0.0, 1.0),
        "v": (-3.0, 3.0),
        "a": (0.3, 2.5),
    },
    "decision_model": "LAN",
    "LAN": "angle",
    "data": ["rt", "response"],
    "choices": [0, 1],
})

# Validate configuration
config.validate()

# Convert to standard Config for HSSM compatibility
standard_config = config.to_config()

Related

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces the RLSSMConfig class, a specialized configuration class for Reinforcement Learning Sequential Sampling Models (RLSSM) that inherits from the BaseModelConfig abstract base class. The implementation provides a flexible and well-tested configuration system tailored to the unique needs of RLSSM models.

Key changes:

  • Adds RLSSMConfig class with RLSSM-specific fields like params_default (list format), decision_process, learning_process, and validation counts
  • Implements factory method from_rlssm_dict() to create configs from existing RLSSM dictionary structures
  • Provides to_config() method for backward compatibility with standard Config class
  • Includes comprehensive test suite with 25 tests achieving 100% coverage

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/hssm/config.py Adds the RLSSMConfig class (lines 244-460) with validation, conversion, and property methods for RLSSM model configuration
tests/test_rlssm_config.py Comprehensive test suite covering creation, validation, defaults retrieval, conversion to Config, and data alias functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cpaniaguam cpaniaguam linked an issue Dec 15, 2025 that may be closed by this pull request
@cpaniaguam cpaniaguam changed the base branch from 805-rlssm-model-config to main December 16, 2025 15:23
Copy link
Member

@AlexanderFengler AlexanderFengler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is on the right track, but it's not yet being tested with integration right? Left a few comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cpaniaguam cpaniaguam requested a review from krishnbera January 27, 2026 19:53
Copy link
Member

@AlexanderFengler AlexanderFengler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few very small comments. Thanks @cpaniaguam

model_name=model_name,
loglik_kind=loglik_kind,
response=["rt", "response"],
response=DEFAULT_RLSSM_RESPONSE,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as per comment above, I think it's semantically a bit confusing to have the RLSSM default show up here.

Also sidenote that I just notice now.

We are doing a redefinition of reponse --> ['rt', 'response'] here, which is a bit confusing.

Maybe renaming this argument to observed_data_vars makes more sense globally. (This can be either ["response"] or ["rts", "response"] or even something entirely different later).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @AlexanderFengler. I think @krishnbera was using the name data for this. However, in HSSM model configs response was being used already. In the interest of being more consistent I sort of defaulted to

response = ["rt", "response"]

for this config class. We can use observed_data_vars as you suggest. Again, we can make changes to this later as we actually start to use it to build models. Thoughts?

Copy link
Collaborator

@krishnbera krishnbera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@cpaniaguam cpaniaguam requested a review from krishnbera February 6, 2026 14:45
@cpaniaguam cpaniaguam merged commit fe58a87 into main Feb 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RLSSM model config

3 participants