fix(us-ci-004): refine TransferLearning cross-domain exception messages - #225
Conversation
- Simplified InvalidOperationException messages in TransferNeuralNetwork and TransferRandomForest - Aligned with user story Option 2 guidance for clearer API direction - Removed technical details about API limitations - Direct users to public Transfer() method that accepts source data - Build verified: 0 errors, 0 warnings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary by CodeRabbit
WalkthroughException messages in two transfer learning algorithm classes are updated to provide clearer guidance. Users attempting cross-domain transfer through protected methods are now directed to use the public Transfer method that accepts both source and target data. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🔇 Additional comments (2)
Comment |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
…e in initializerandomsolution The optimizer's _model field was null when InitializeRandomSolution accessed model.ParameterCount because the model was never set on the optimizer after configuration. Changes: - Add SetModel(IFullModel) method to IOptimizer interface - Implement SetModel in OptimizerBase to set the _model field - Implement SetModel in ShardedOptimizerBase to delegate to wrapped optimizer - Call SetModel in AiModelBuilder before Optimize() in all training paths: - Regular training path (line 2107) - Hyperparameter optimization trial (line 1940) - Knowledge distillation fallback (line 5269) - Deep ensemble member optimizer (line 6793) This fixes Issue #225: [Fix] Kill Time Series Stubs & Implement Real Training by ensuring the model is always available to the optimizer before training. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…in InitializeRandomSolution (#823) * fix: add setmodel method to ioptimizer interface to fix null reference in initializerandomsolution The optimizer's _model field was null when InitializeRandomSolution accessed model.ParameterCount because the model was never set on the optimizer after configuration. Changes: - Add SetModel(IFullModel) method to IOptimizer interface - Implement SetModel in OptimizerBase to set the _model field - Implement SetModel in ShardedOptimizerBase to delegate to wrapped optimizer - Call SetModel in AiModelBuilder before Optimize() in all training paths: - Regular training path (line 2107) - Hyperparameter optimization trial (line 1940) - Knowledge distillation fallback (line 5269) - Deep ensemble member optimizer (line 6793) This fixes Issue #225: [Fix] Kill Time Series Stubs & Implement Real Training by ensuring the model is always available to the optimizer before training. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: correct arima predict vector bounds for edge cases - Use _arCoefficients.Length instead of LagOrder for lastObservedValues to ensure dot product vectors have matching lengths - Guard lastObservedValues[0] access when P=0 (pure MA model) - Guard lastErrors[0] access when Q=0 (pure AR model) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: address PR review comments and add SetModel to all test optimizers - Add SetModel implementation to all test optimizer classes: - FederatedDeterministicDeltaOptimizer - FederatedNoOpOptimizer - SinglePassTestOptimizer - ResetTrackingOptimizer - MockOptimizer - PassthroughOptimizer - SingleStepTrainOptimizer - DeterministicNeuralNetworkParameterOptimizer - Address PR review comments: - Improve SetModel comments in AiModelBuilder to clarify purpose - Add Reset() before SetModel in KD fallback path for consistency - Make SetModel virtual in OptimizerBase with OnModelChanged hook - Add breaking change documentation to IOptimizer.SetModel Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: address remaining PR review comments - Reorder HPO objective function: apply trial hyperparameters BEFORE Reset() so adaptive state is initialized from new hyperparameters - Improve SetModel comment wording to not imply Reset() clears the model - Update OnModelChanged signature to pass oldModel and newModel parameters allowing derived classes to react to model changes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: add coderabbit configuration with facade pattern guidelines Configure CodeRabbit code reviews to enforce: - Facade pattern: users should only use AiModelBuilder and AiModelResult - Access modifier guidelines: prefer internal over public to hide IP - Review checklist for maintaining clean public API surface Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: correct MaternKernel parameter name in playground example The matern-kernel playground example used 'length' but the constructor parameter is named 'lengthScale', causing compilation test failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: add RequireModel() guard to replace null-forgiving _model! access Adds a protected RequireModel() helper that returns the model or throws InvalidOperationException with a clear message pointing to SetModel(). Replaces all _model! usages with RequireModel() for better diagnostics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: franklinic <franklin@ivorycloud.com>
Summary
Changes Made
TransferNeuralNetwork.cs:
TransferRandomForest.cs:
Test Plan
Acceptance Criteria Met
🤖 Generated with Claude Code