-
Notifications
You must be signed in to change notification settings - Fork 51
Anchor items #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Anchor items #91
Conversation
Details: Add AnchorItem model for representing fixed parameter items Add anchor_items field to Dataset class Implement add_anchor_items() method for adding anchor items Add get_anchor_indices() helper method
Details: Implement AnchorItemInitializer class for anchor items Register as 'anchor_items' in INITIALIZERS registry Set fixed parameter values and near-zero scales for anchors Support all IRT model types (1PL-4PL)
Details: Add anchor gradient zeroer integration Implement manual parameter reset after SVI steps Handle constrained parameters correctly Clean up hooks after training completion
Details: Implement AnchorGradientZeroer class Add gradient hook registration and cleanup Support constrained parameter handling Create helper function for dataset integration
Details: Test anchor items addition and validation Test training with anchor items Test gradient zeroer functionality Verify parameter stability during training
Details: Demonstrate basic anchor items usage Show comparison with and without anchors Example of partial anchoring (difficulty only) Include verification of parameter stability
|
Thanks for submitting this PR! Could you add some details to this thread to describe the anchor items? Citations, use cases, etc. to help with the review and for documenting this addition in the package? Thanks! |
|
Pinging @eliyahabba to follow up re: my last comment. Checks are passing but it'd be great if there was some more detail on the PR/documentation side. Thanks! |
|
Sure thing! Sorry for the delay I haven't had a chance to add the documentation yet, but I'll work on it as soon as possible |
Details: - Complete user guide with quick start - API reference for all anchor items methods - Three detailed use cases with code examples - Implementation details and architecture - Troubleshooting guide and limitations - Citations to psychometric literature"
|
I added :) |
Add Anchor Items Support for IRT Models
Overview
This PR adds anchor items functionality to py-irt, enabling users to fix specific item parameters during model calibration. This is essential for test linking, test equating, and maintaining measurement scales across different test administrations.
What are Anchor Items?
Anchor items are items with pre-determined, fixed parameter values that remain constant during training. They serve as reference points, allowing new items to be calibrated on the same scale as previously calibrated items.
Background and Citations
Anchor items are a foundational technique in psychometrics and educational measurement:
Key References:
Key Features
✅ Fixed Parameters During Training
✅ Simple, Intuitive API
✅ Flexible Anchoring Options
Implementation Details
Architecture
The implementation consists of three main components:
Dataset Extensions (
py_irt/dataset.py)AnchorItemclass for storing anchor item informationadd_anchor_items()method for adding anchors to datasetsget_anchor_indices()helper for retrieving anchor indicesAnchor Initializer (
py_irt/initializers.py)AnchorItemInitializersets initial values for anchor parameters'anchor_items'in the initializers registryGradient Management (
py_irt/anchor_utils.py)AnchorGradientZeroerzeros gradients for anchor items during trainingHow It Works
The implementation uses a dual approach to ensure parameters stay fixed:
This dual approach handles:
Technical Highlights
Use Cases
1. Test Linking
Link different test forms to a common scale using shared anchor items:
2. Incremental Calibration
Add new items to existing item bank while keeping calibrated items fixed:
3. Test Equating
Ensure parallel test forms measure on the same scale:
Files Changed
Modified Files
py_irt/dataset.py: Add anchor items support to Dataset classpy_irt/initializers.py: Add AnchorItemInitializerpy_irt/training.py: Integrate anchor items in training loopNew Files
py_irt/anchor_utils.py: Gradient management utilitiestests/test_anchor_items.py: Comprehensive test suite (4 tests, all passing)examples/anchor_items_example.py: Three complete working examplesdocs/ANCHOR_ITEMS.md: Complete user documentation (400+ lines)Testing
Test Coverage
All tests pass successfully ✅
Test Coverage Includes
Verification Results
Documentation
Comprehensive Documentation Included
Example Code
Supported Models
difficultydifficulty,discriminationdifficulty,discrimination,guessingdifficulty,discrimination,guessing,slipLimitations
Breaking Changes
None - This is a purely additive feature. Existing code continues to work without any modifications.
Migration Guide
No migration needed. To use anchor items:
dataset.add_anchor_items(anchor_items)'anchor_items'in your initializers:IrtConfig(initializers=['anchor_items'])Examples
Run the included example:
Run the tests:
Benefits
Backward Compatibility
✅ Fully backward compatible - No changes to existing functionality. This feature is opt-in only.
Future Enhancements
Potential future additions (not in this PR):
Review Checklist
Acknowledgments
This implementation addresses a common need in educational testing and psychometrics for maintaining measurement scales across test administrations.