GPy/backlog/features/2025-08-15_matlab-comparison-framework.md

77 lines
2.8 KiB
Markdown
Raw Normal View History

---
id: "matlab-comparison-framework"
title: "Create MATLAB comparison framework for LFM kernel validation"
status: "In Progress"
priority: "High"
created: "2025-08-15"
last_updated: "2025-08-15"
owner: "Neil Lawrence"
github_issue: ""
dependencies: "lfm-kernel-code-review"
tags:
- lfm
- kernel
- validation
- matlab
- comparison
---
# Create MATLAB comparison framework for LFM kernel validation
## Description
Create a comprehensive comparison framework to validate our GPy LFM kernel implementation against the MATLAB reference implementation in GPmat.
## Background
- We have analyzed the complete MATLAB implementation (SIM, DISIM kernels)
- Need to validate our GPy implementation against the reference
- Comparison framework will ensure mathematical correctness and numerical accuracy
- Will help catch implementation errors and validate parameter handling
## Implementation Tasks
- [x] Create MATLAB comparison script (`scripts/compare_with_matlab.py`)
- [ ] Test MATLAB script with existing GPmat installation
- [ ] Create standard test cases for SIM and DISIM kernels
- [ ] Implement GPy computation integration in comparison script
- [ ] Add parameter validation and constraint testing
- [ ] Create visualization tools for comparison results
- [ ] Add cross-kernel computation validation
- [ ] Document comparison methodology and tolerance standards
## Test Cases to Implement
- [ ] Basic SIM kernel with standard parameters
- [ ] SIM kernel with fast decay and no delay
- [ ] Basic DISIM kernel with hierarchical parameters
- [ ] Edge cases (zero delay, extreme decay values)
- [ ] Multi-output scenarios
- [ ] Cross-kernel computations (SIM × RBF, DISIM × SIM)
## Acceptance Criteria
- [ ] MATLAB comparison script runs successfully
- [ ] Standard test cases produce consistent results
- [ ] Comparison framework can detect implementation errors
- [ ] Tolerance standards defined and documented
- [ ] Results visualization and reporting implemented
- [ ] Framework integrated into development workflow
## Implementation Notes
- Use scipy.io for loading MATLAB .mat files
- Support both MATLAB and Octave as reference implementations
- Implement robust error handling for missing dependencies
- Create standardized test data sets for reproducible comparisons
- Consider numerical precision differences between platforms
## Related
- Backlog: lfm-kernel-code-review
- Backlog: implement-lfm-kernel-core
- MATLAB Implementation: ~/lawrennd/GPmat/matlab/
## Progress Updates
### 2025-08-15
Created initial MATLAB comparison framework:
- Implemented `MATLABComparison` class with automatic MATLAB/Octave detection
- Created test case generation for SIM and DISIM kernels
- Added result comparison with tolerance checking
- Framework ready for integration with GPy implementation
- Script can generate MATLAB code dynamically for different test cases