-
-
Notifications
You must be signed in to change notification settings - Fork 7
Add comprehensive integration tests to repo #472
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?
Add comprehensive integration tests to repo #472
Conversation
…ion tests - Create IntegrationTests folder structure separate from UnitTests - Add comprehensive Matrix integration tests with mathematically verified results - Test matrix multiplication, transpose, inverse, determinant, trace, and arithmetic operations - Include tests for multiple numeric types (double, float, decimal) - Establish pattern for integration testing with golden datasets
…erification - Add comprehensive Vector integration tests for dot product, cross product, magnitude, normalization - Test vector arithmetic operations (addition, subtraction, scalar multiplication) - Add distance metrics (Euclidean, cosine similarity) with verified results - Add comprehensive Statistics integration tests for all statistical functions - Test mean, variance, standard deviation, median with known values - Test correlation, covariance, z-score, percentiles with mathematical verification - Test skewness, kurtosis, mode, range, geometric/harmonic means - All tests use mathematically verified expected values - Create folder structure for all 47 feature areas
- Add comprehensive SimpleRegression integration tests for linear regression - Test perfect linear fits, negative slopes, zero intercepts, confidence intervals - Test residual analysis, R-squared, standard error calculations - Add comprehensive ActivationFunctions integration tests - Test ReLU, Sigmoid, Tanh, Softmax, LeakyReLU, ELU, GELU - Verify mathematical correctness of activation functions and their properties - Test softmax probability distributions, sigmoid asymptotic behavior - Test activation function idempotency and symmetry properties - All tests use mathematically verified expected values
- Add 171 Matrix integration tests covering all operations, edge cases, and properties - Test all MatrixHelper methods (determinant, orthogonalization, Givens rotation, etc.) - Test all 40+ MatrixExtensions property checks (IsSymmetric, IsDiagonal, etc.) - Add 111 Vector integration tests covering all operations and LINQ-style methods - Test all distance metrics, norms, and statistical operations - Add 107 Tensor integration tests for multi-dimensional arrays - Test 0D-5D tensors including image batches (NCHW) and video formats - Test reshape, transpose, slicing, concatenation, and reduction operations - All tests use mathematically verified expected values with 10 decimal precision - Comprehensive edge case coverage (empty, single element, large, sparse, etc.) - Multiple numeric type testing (double, float, decimal, int) - Total: 389 integration tests for LinearAlgebra core classes
…egration tests Regression Models (263 tests - 8 files): - All 42 regression models now have complete integration test coverage - LinearModelsIntegrationTests: 9 models (Multivariate, Multiple, Weighted, Robust, Quantile, etc.) - PolynomialAndSplineIntegrationTests: Polynomial, Spline - LogisticAndGeneralizedIntegrationTests: Logistic, Multinomial, Poisson, NegativeBinomial - TreeBasedModelsIntegrationTests: 8 models (DecisionTree, RandomForest, GradientBoosting, etc.) - KernelAndDistanceIntegrationTests: SVM, KernelRidge, KNN, LocallyWeighted - BayesianAndProbabilisticIntegrationTests: Bayesian, GaussianProcess - NeuralNetworkIntegrationTests: 3 models (NeuralNetwork, MLP, RBF) - AdvancedModelsIntegrationTests: 5 models (GAM, Isotonic, TimeSeries, Genetic, Symbolic) - Each model tested for: fit, predict, R², edge cases, parameter variations, multiple data sizes Statistics (175+ tests): - Complete StatisticsHelper coverage with mathematically verified values - Hypothesis testing: T-tests, Mann-Whitney, Chi-square, F-test, Permutation - Probability distributions: Normal, Chi-square, Exponential, Weibull, LogNormal, Laplace, Student's t - Regression statistics: R², Adjusted R², residuals, Durbin-Watson, AIC, BIC, VIF - Error metrics: MSE, RMSE, MAE, MAPE, SMAPE, MBE, Theil's U - Correlation measures: Pearson, Spearman, Kendall Tau - Time series: ACF, PACF - Classification: Confusion matrix, ROC, AUC - Advanced: Gamma functions, distribution fitting, covariance matrices LossFunctions (117 tests): - All 13 loss functions with complete coverage - MSE, MAE, Binary/Categorical Cross-Entropy, Hinge, Huber, Focal, Dice, Jaccard, Log-Cosh, RMSE - Forward pass tests with perfect/worst predictions - Numerical gradient verification using finite differences - Mathematical properties: non-negativity, convexity, triangle inequality - Edge cases: zeros, large values, small values, negative values - Batch operations and performance tests (10,000 elements) - Numerical stability tests - Comparative tests between related loss functions Total: 555+ new integration tests, ~18,000 lines of test code
…ning integration tests Optimizers (120 tests): - ALL 22 optimizers tested: Adam, SGD, Momentum, RMSProp, AdaGrad, AdaDelta, Nadam, AMSGrad - BFGS, DFP, L-BFGS, Newton's Method, Conjugate Gradient, Nesterov, AdaMax, Lion, FTRL, etc. - Convergence tests on quadratic functions to known optima - Learning rate effects, momentum effects, hyperparameter variations - Edge cases: zero gradients, large gradients, oscillating loss - Serialization tests, performance comparisons - Both double and float type support NeuralNetworks (171 tests - 6 files): - DenseLayerIntegrationTests: forward/backward, parameters, training scenarios, XOR, regression - ConvolutionalLayerIntegrationTests: kernels, strides, padding, multi-channel, batch processing - RecurrentLayerIntegrationTests: RNN, LSTM, GRU - sequences, temporal dependencies, gates - PoolingAndNormalizationLayerIntegrationTests: MaxPool, AvgPool, BatchNorm, LayerNorm, GlobalPool - SpecializedLayerIntegrationTests: Dropout, Embedding, Flatten, Reshape, Attention, MultiHead, etc. - NetworkIntegrationTests: FeedForward, CNN, RNN, Autoencoders, Transformers, end-to-end training - All layers test: forward, backward, parameters, updates, batch sizes, types, clone, reset - Networks test: training (XOR, classification, regression), prediction, overfitting, serialization RAG - Retrieval-Augmented Generation (175 tests - 7 files): - DocumentStoreIntegrationTests: InMemory operations, similarity search, metadata filtering, thread safety - ChunkingStrategyIntegrationTests: 9 strategies (Fixed, Recursive, Sentence, Semantic, Sliding, Markdown, Code, Table, Header) - EmbeddingIntegrationTests: generation, caching, cosine similarity (verified), dot product, Euclidean - RetrieverIntegrationTests: Dense, BM25, TF-IDF, Hybrid, Vector, MultiQuery - metadata, large datasets - RerankerIntegrationTests: CrossEncoder, MMR, Diversity, LostInMiddle, RRF, Identity - AdvancedRAGIntegrationTests: context compression, query expansion, processors, evaluation metrics, advanced patterns - ComprehensiveRAGIntegrationTests: real-world scenarios, edge cases, stress tests, full pipelines - Mathematical verification: cosine similarity 0°/45°/90°/180°, vector normalization - Multilingual support: 6 languages tested MetaLearning (94 tests): - MAML (Model-Agnostic Meta-Learning): 30+ tests for meta-training, first-order, adaptive optimizer - Reptile: 15+ tests for meta-training and adaptation - Episodic Data Loaders: task generation, N-way K-shot (2-way to 10-way, 1-shot to 10-shot) - Fast adaptation: few gradient steps, rapid convergence verification - Support/Query splits: disjoint sets, proper usage - Meta-train vs meta-test separation - Synthetic tasks: sine waves, linear functions - Configuration validation, result objects, save/load - Learning rate, batch size, inner steps variations Total: 560 new integration tests, ~11,000 lines of test code
…n tests TransferLearning (118 tests - 4 files): - DomainAdaptationIntegrationTests: CORAL and MMD domain adapters (32 tests) - FeatureMappingIntegrationTests: LinearFeatureMapper with dimension transformations (31 tests) - TransferAlgorithmsIntegrationTests: TransferNeuralNetwork and TransferRandomForest (32 tests) - EndToEndTransferLearningTests: Complete workflows, realistic scenarios, robustness (23 tests) - Source→Target transfer with small/medium/large domain gaps - Cross-domain transfers with dimension reduction/expansion - Multi-stage and bidirectional transfers - Performance improvements validated LoRA - Low-Rank Adaptation (64 tests): - LoRALayer: All ranks (1, 4, 8, 16, 32), forward/backward, parameters, alpha scaling - StandardLoRAAdapter: Wrapping layers, frozen base, parameter efficiency - DefaultLoRAConfiguration: Configuration and application - Parameter efficiency: >100x reduction verified (4096x4096 with rank=8 = 256x) - Adaptation quality: XOR learning, sine wave approximation, merged layer equivalence - Training scenarios: convergence with gradient descent and optimizers - Memory efficiency: frozen adapters don't compute base gradients - Low-rank property: matrix A Gaussian init, matrix B zero init - Integration with neural networks and multi-layer scenarios - Mathematical verification: W_lora = A*B*(alpha/rank) AutoML (102 tests): - ParameterRange: Integer, Float, Boolean, Categorical, Continuous with constraints - SearchSpace: Operations, nodes, input/output channels - SearchConstraint: Range, Dependency, Exclusion, Resource, Custom constraints - Architecture: Operation tracking, node management - TrialResult: Trial tracking, success/failure, metadata - NeuralArchitectureSearch: DARTS (gradient-based), Random search, status lifecycle - SuperNet: Forward/backward, architecture derivation, serialization, interpretability - Hyperparameter optimization: Grid, Random, Bayesian-style search - Optimization metrics: Accuracy, F1, Precision, Recall, AUC, MSE, RMSE, MAE, R² - Early stopping, model selection, best model preservation - Pipeline automation with time/trial limits Total: 284 new integration tests
…rnels integration tests Genetics (100 tests): - Gene types: BinaryGene, RealGene, PermutationGene with cloning and equality - Individuals: BinaryIndividual, RealValuedIndividual, PermutationIndividual - Classic problems: OneMax, Sphere, Rastrigin, Rosenbrock, Ackley, Griewank, Levy, TSP - Selection methods: Tournament, Roulette, Rank, Truncation, Uniform, SUS, Elitism - Crossover operators: Single-point, Two-point, Uniform, Arithmetic, Order Crossover - Mutation operators: Bit-flip, Gaussian, Swap, Inversion - Evolution mechanisms: convergence, diversity, premature convergence prevention - Parameter effects: population size, mutation rate, crossover rate, elitism - Real-world applications: feature selection, weight optimization - Constrained optimization, niching, statistical validation, scalability tests Normalizers (100 tests): - ALL 9 normalizers with 100% coverage - ZScoreNormalizer (StandardScaler): mean=0, std=1 - MinMaxNormalizer: range [0,1] or custom - MaxAbsScaler: range [-1,1], preserves zeros - RobustScalingNormalizer: median-centered, IQR-scaled, robust to outliers - LpNormNormalizer: L1 and L2 norm normalization - QuantileTransformer: uniform/normal distribution transformation - MeanVarianceNormalizer, LogNormalizer, BinningNormalizer - Mathematical properties verified: mean, std, range, norm - Inverse transform (denormalize) recovers original values - Edge cases: zero variance, outliers, single samples, large/small values - Real-world scenarios: age, income, test scores, housing prices Regularization (87 tests): - L1 Regularization (Lasso): soft thresholding, sparsity creation - L2 Regularization (Ridge): uniform shrinkage, proportional reduction - ElasticNet: L1+L2 combination with L1Ratio (0.0 to 1.0) - Penalty computation: Σ|wi| for L1, Σwi² for L2 - Gradient computation: sign(w) for L1, w for L2 - Mathematical verification of shrinkage formulas - Sparsity tests: L1 creates zeros, L2 keeps all non-zero - Various strengths tested: 0.001 to 100.0 - Edge cases: all zeros, single elements, very large strength - Sign preservation, weight magnitude reduction - Matrix/Vector/Tensor consistency, float/double support Kernels (81 tests): - ALL 7 kernel types with 100% coverage - Linear Kernel: x·y dot product - Polynomial Kernel: (x·y + c)^d with degrees 1-5 - Gaussian/RBF Kernel: exp(-γ||x-y||²) with various sigma - Sigmoid Kernel: tanh(αx·y + c) with parameter variations - Laplacian Kernel: exp(-||x-y||₁/σ) with Manhattan distance - Rational Quadratic Kernel: multi-scale similarity - Cauchy Kernel: long-tail properties - Kernel properties verified: symmetry, positive semi-definiteness, self-similarity - Gram matrix: symmetry, diagonal elements, large matrices (5x5) - Edge cases: identical/orthogonal/zero vectors, 1D to 100D, extreme scales - Cross-kernel comparisons, numerical stability, type compatibility Total: 368 new integration tests
…alidators, and TimeSeries integration tests
This commit adds extensive integration testing coverage for 5 major feature areas:
1. ActivationFunctions (136 tests):
- Completed tests for all 31 remaining activation functions
- Total coverage: 38 activation functions with forward/backward pass verification
- Functions: BinarySpiking, BentIdentity, CELU, Identity, HardTanh, Gaussian,
HardSigmoid, ISRU, HierarchicalSoftmax, LogSoftmax, LogSoftmin, LiSHT,
Maxout, Mish, PReLU, RReLU, SELU, Sign, SiLU, SoftPlus, SoftSign, Softmin,
Sparsemax, SphericalSoftmax, Squash, ScaledTanh, SQRBF, ThresholdedReLU,
TaylorSoftmax, Swish, GumbelSoftmax
2. FeatureSelectors (55 tests):
- CorrelationFeatureSelector: correlation-based filtering
- VarianceThresholdFeatureSelector: variance-based filtering
- UnivariateFeatureSelector: statistical scoring (F-value, Chi-Squared, MI)
- NoFeatureSelector: pass-through baseline
- SelectFromModel: importance-based selection
- RecursiveFeatureElimination: iterative feature ranking
- SequentialFeatureSelector: forward/backward selection
- Edge cases: empty sets, chaining, type support
3. CrossValidators (51 tests):
- StandardCrossValidator: basic train/test splits
- KFoldCrossValidator: k-fold cross-validation
- StratifiedKFoldCrossValidator: stratified k-fold
- LeaveOneOutCrossValidator: LOOCV
- GroupKFoldCrossValidator: group-preserving k-fold
- TimeSeriesCrossValidator: temporal ordering preservation
- MonteCarloValidator: random sampling
- NestedCrossValidator: nested CV for hyperparameter tuning
- Verification: disjointness, completeness, proportions
4. TimeSeries Basic Models (90 tests):
- ARModel: autoregressive modeling
- MAModel: moving average modeling
- ARMAModel: combined AR+MA
- ARIMAModel: integrated ARMA with differencing
- SARIMAModel: seasonal ARIMA
- ARIMAXModel: ARIMA with exogenous variables
- ExponentialSmoothingModel: simple/double/triple smoothing
- StateSpaceModel: Kalman filtering
- STLDecomposition: seasonal-trend decomposition (28 comprehensive tests)
5. TimeSeries Advanced Models (120 tests):
- VectorAutoRegressionModel (VAR): multivariate forecasting
- VARMAModel: vector ARMA
- GARCHModel: volatility modeling
- TBATSModel: complex seasonal patterns
- ProphetModel: Facebook Prophet
- UnobservedComponentsModel: UCM
- BayesianStructuralTimeSeriesModel: BSTS
- TransferFunctionModel: input-output relationships
- InterventionAnalysisModel: intervention detection
- DynamicRegressionWithARIMAErrors: regression with correlated errors
- SpectralAnalysisModel: frequency domain analysis
- NeuralNetworkARIMAModel: hybrid NN-ARIMA
- NBEATSModel: deep neural forecasting
- NBEATSBlock: N-BEATS building blocks
Total: 452 new comprehensive integration tests
Lines added: 12,408
Files: 5 (1 updated, 4 new)
All tests include:
- Mathematical verification with known expected values
- Edge case coverage
- Parameter variation testing
- Type support (double, float where applicable)
- Realistic synthetic datasets
- xUnit conventions with clear naming
…t, and Window integration tests
This commit adds extensive integration testing coverage for 5 major feature areas:
1. Interpolation Basic Methods (112 tests):
- LinearInterpolation: linear interpolation between points
- NearestNeighborInterpolation: nearest neighbor lookup
- LagrangePolynomialInterpolation: Lagrange polynomial
- NewtonDividedDifferenceInterpolation: Newton's divided difference
- HermiteInterpolation: Hermite polynomial with derivatives
- BarycentricRationalInterpolation: barycentric rational form
- TrigonometricInterpolation: trigonometric polynomials
- SincInterpolation: sinc function interpolation
- WhittakerShannonInterpolation: Whittaker-Shannon formula
- LanczosInterpolation: Lanczos kernel-based
- CubicConvolutionInterpolation: cubic convolution for 2D
- BilinearInterpolation: 2D bilinear interpolation
- BicubicInterpolation: 2D bicubic interpolation
- Interpolation2DTo1DAdapter: 2D to 1D adapter pattern
- Verification: data point recovery, midpoint interpolation, edge cases
2. GaussianProcesses (58 tests):
- StandardGaussianProcess: standard GP regression (20 tests)
- SparseGaussianProcess: sparse approximations with inducing points (19 tests)
- MultiOutputGaussianProcess: multiple outputs with correlations (19 tests)
- Tests: noiseless/noisy data, kernel effects (Gaussian, Linear, Matern),
uncertainty quantification, confidence intervals, prior/posterior behavior,
extrapolation, multidimensional inputs, computational efficiency
3. RadialBasisFunctions (91 tests):
- GaussianRBF, MultiquadricRBF, InverseMultiquadricRBF, ThinPlateSplineRBF
- CubicRBF, LinearRBF, PolyharmonicSplineRBF, SquaredExponentialRBF
- MaternRBF, RationalQuadraticRBF, ExponentialRBF, SphericalRBF
- InverseQuadraticRBF, WaveRBF, WendlandRBF, BesselRBF
- Tests: zero distance values, symmetry, decay behavior, derivatives,
shape parameters, positive definiteness, compact support
4. WaveletFunctions (118 tests):
- Discrete wavelets: Haar, Daubechies, Symlet, Coiflet, Biorthogonal
- Continuous wavelets: Morlet, Complex Morlet, Mexican Hat, Gaussian
- Advanced wavelets: Meyer, Paul, Shannon, Gabor, DOG, BSpline,
Battle-Lemarié, Fejér-Korovkin, Complex Gaussian, Reverse Biorthogonal
- Multi-resolution analysis: 21 comprehensive tests
- Tests: admissibility, orthogonality, normalization, perfect reconstruction,
symmetry, vanishing moments, filter coefficients, signal decomposition
5. WindowFunctions (111 tests):
- Basic: Rectangular, Hanning, Hamming, Triangular, Bartlett, Welch
- Advanced: Blackman, Blackman-Harris, Blackman-Nuttall, Nuttall, FlatTop
- Parametric: Tukey, Gaussian, Kaiser, Poisson (with parameter variations)
- Specialized: Cosine, Parzen, Bohman, Bartlett-Hann, Lanczos
- Tests: symmetry, edge values, center values, monotonicity, normalization,
parameter effects, mathematical formula verification, FFT properties
Total: 490 new comprehensive integration tests
Lines added: 9,007
Files: 5 new test files
All tests include:
- Mathematical verification with known expected values
- Edge case coverage (minimal data, boundaries, special values)
- Parameter variation testing
- Symmetry and property verification
- xUnit conventions with clear naming
- High precision assertions (1e-10 for exact, 1e-8 general)
- Realistic synthetic datasets
Note: Interpolation Advanced Methods (splines, RBF interpolation, Kriging, etc.)
will be added in a future commit due to scope.
…s, and Serialization/Validation integration tests
This commit adds extensive integration testing coverage for 5 major feature areas:
1. Interpretability (64 tests):
- Explanation methods:
* LimeExplanation: local interpretable model-agnostic explanations
* AnchorExplanation: rule-based explanations with precision/coverage
* CounterfactualExplanation: minimal changes for different outcomes
- Bias detectors:
* DemographicParityBiasDetector: statistical parity difference
* EqualOpportunityBiasDetector: TPR differences across groups
* DisparateImpactBiasDetector: 80% rule verification
- Fairness evaluators:
* BasicFairnessEvaluator: demographic parity, disparate impact
* GroupFairnessEvaluator: equal opportunity, equalized odds
* ComprehensiveFairnessEvaluator: all 6 major fairness metrics
- Helper utilities: InterpretabilityMetricsHelper, model helpers
- Real-world scenarios: credit scoring, hiring, loan approval
2. OutlierRemoval (52 tests):
- ZScoreOutlierRemoval: standard deviation-based (3-sigma rule)
- IQROutlierRemoval: interquartile range method (1.5*IQR)
- MADOutlierRemoval: median absolute deviation (robust to skewness)
- ThresholdOutlierRemoval: custom user-defined thresholds
- NoOutlierRemoval: pass-through baseline
- Tests: normal/skewed/multimodal distributions, edge cases,
mathematical verification, precision/recall, multivariate data
3. FitDetectors Basic (111 tests - 14 detectors):
- DefaultFitDetector, ResidualAnalysisFitDetector
- CrossValidationFitDetector, KFoldCrossValidationFitDetector
- StratifiedKFoldCrossValidationFitDetector, HoldoutValidationFitDetector
- TimeSeriesCrossValidationFitDetector, LearningCurveFitDetector
- ConfusionMatrixFitDetector, ROCCurveFitDetector
- PrecisionRecallCurveFitDetector, BootstrapFitDetector
- JackknifeFitDetector, ResidualBootstrapFitDetector
- Tests: overfitting/underfitting/good fit detection, metrics calculation,
statistical significance, confidence levels, edge cases
4. FitDetectors Advanced (104 tests - 17 detectors):
- InformationCriteriaFitDetector: AIC, BIC, AICc model comparison
- AutocorrelationFitDetector: Durbin-Watson statistic
- HeteroscedasticityFitDetector: Breusch-Pagan, White tests
- CookDistanceFitDetector: influential points detection
- VIFFitDetector: variance inflation factor (multicollinearity)
- CalibratedProbabilityFitDetector: probability calibration
- FeatureImportanceFitDetector, PartialDependencePlotFitDetector
- ShapleyValueFitDetector, PermutationTestFitDetector
- BayesianFitDetector: DIC, WAIC, LOO
- GaussianProcessFitDetector: GP uncertainty quantification
- NeuralNetworkFitDetector, GradientBoostingFitDetector
- EnsembleFitDetector, HybridFitDetector, AdaptiveFitDetector
5. Serialization and Validation (79 tests):
- Serialization (4 components, 35 tests):
* MatrixJsonConverter: JSON serialization for matrices
* VectorJsonConverter: JSON serialization for vectors
* TensorJsonConverter: JSON serialization for tensors (1D-5D)
* JsonConverterRegistry: converter management
- Validation (5 components, 38 tests):
* VectorValidator: length and shape validation
* TensorValidator: shape, rank, forward pass requirements
* RegressionValidator: feature count, dimensions, data values
* ArchitectureValidator: neural network compatibility
* SerializationValidator: streams, files, versions, layer types
- Integration scenarios (6 tests): complete serialization pipelines,
neural network validation, multi-structure tests
Total: 410 new comprehensive integration tests
Lines added: 8,519
Files: 5 new test files
All tests include:
- Mathematical verification with known expected values
- Edge case coverage (empty, single element, null handling)
- Special values (NaN, Infinity, -Infinity)
- Multiple data types and dimensions
- Realistic synthetic datasets with known properties
- Statistical significance testing
- xUnit conventions with clear naming
- High precision assertions (1e-10 for exact, 1e-8 general)
- Comprehensive documentation and comments
…aching, and NumericOperations integration tests
This commit adds extensive integration testing coverage for 5 major feature areas:
1. Agents (63 tests):
- Agent (ReAct): reasoning and acting pattern with tool execution
- ChainOfThoughtAgent: pure reasoning without tools, multi-step thinking
- PlanAndExecuteAgent: planning strategy with plan revision
- RAGAgent: retrieval-augmented generation with citations and reranking
- AgentKeyResolver: API key resolution with priority system
- AgentGlobalConfiguration: global provider configuration
- AgentBase: abstract base class behavior
- Tests: initialization, tool execution, multi-turn conversations,
error handling, max iterations, context management, scratchpad tracking
- Mock implementations: no external API calls, all tests use mocks
2. LanguageModels (53 tests):
- OpenAIChatModel: GPT-3.5, GPT-4, GPT-4-turbo, GPT-4o
- AnthropicChatModel: Claude Opus, Sonnet, Haiku, 2.1
- AzureOpenAIChatModel: Azure endpoint formatting, deployment handling
- ChatModelBase: base functionality, parameter validation
- Tests: model initialization, message formatting, request structure,
authentication (Bearer, x-api-key, api-key), response parsing,
token counting, error handling (400, 401, 429, 500), retry logic,
parameter validation (temperature, topP, penalties, topK)
- Mock HTTP handler: no external API calls, synthetic responses
3. FitnessCalculators Basic (91 tests - 13 calculators):
- Regression metrics: MSE, MAE, RMSE, R², Adjusted R²
- Loss functions: BinaryCrossEntropy, CategoricalCrossEntropy,
CrossEntropy, WeightedCrossEntropy, Hinge, SquaredHinge,
Huber, ModifiedHuber
- Tests: correct calculation with known values, perfect predictions,
worst predictions, mathematical properties (MSE ≥ 0, R² ≤ 1),
edge cases, manual calculation comparison, API properties
4. FitnessCalculators Advanced (79 tests - 13 calculators):
- LogCoshLoss: robust regression with MSE/MAE approximations
- QuantileLoss: quantile regression with asymmetric penalties
- PoissonLoss: count-based prediction
- KullbackLeiblerDivergence: probability distribution comparison
- DiceLoss: segmentation overlap (F1-based)
- JaccardLoss: IoU loss for object detection
- FocalLoss: imbalanced classification with gamma/alpha parameters
- ContrastiveLoss: pair-based similarity learning
- TripletLoss: triplet-based metric learning
- CosineSimilarityLoss: direction-based similarity (scale invariant)
- ElasticNetLoss: L1+L2 regularization combination
- ExponentialLoss: AdaBoost loss
- OrdinalRegressionLoss: ordered category prediction
- Tests: perfect/worst predictions, mathematical verification,
parameter effects, realistic scenarios (segmentation, imbalanced
classification, embedding similarity)
5. Caching and NumericOperations (67 tests):
- Caching (11 tests):
* DefaultModelCache: store/retrieve models, cache management
* DefaultGradientCache: gradient caching with thread safety
* DeterministicCacheKeyGenerator: consistent key generation
- NumericOperations (53 tests - all 13 numeric types):
* Byte, SByte: overflow behavior, signed operations
* Int16/Short, UInt16: basic operations
* Int32, UInt32, UInt, Int64, UInt64: arithmetic, comparisons
* Float, Double, Decimal: precision, special values (NaN, Infinity)
* Complex<T>: advanced math (Euler's formula: e^(πi) = -1)
- Tests: arithmetic (add, subtract, multiply, divide, negate),
comparisons, special operations (zero, one, sqrt, square, abs,
exp, log, power), conversions, edge cases (overflow, NaN),
mathematical verification (Euler's formula, complex division)
Total: 353 new comprehensive integration tests
Lines added: 7,271
Files: 5 new test files
Combined Fitness Calculator Coverage:
- Part 1 (Basic): 91 tests for 13 calculators
- Part 2 (Advanced): 79 tests for 13 calculators
- Total: 170 tests for 26 fitness calculators
All tests include:
- Mathematical verification with known expected values
- Mock implementations (no external API calls)
- Edge case coverage (overflow, NaN, Infinity, empty, null)
- Thread safety testing (where applicable)
- Realistic scenarios (segmentation, embeddings, imbalanced classes)
- Parameter variation testing
- xUnit conventions with clear naming
- High precision assertions (1e-10 for double, 1e-6 for float)
- Comprehensive documentation and comments
|
Warning Rate limit exceeded@ooples has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 39 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (11)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this 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 pull request adds comprehensive integration tests across multiple areas of the AiDotNet library, focusing on validating the correctness of machine learning implementations through mathematically verified test cases.
Key changes:
- Added integration tests for Gaussian Process implementations (StandardGP, SparseGP, MultiOutputGP)
- Added integration tests for fitness calculators (basic regression metrics and advanced loss functions)
- Added integration tests for fit detectors (overfitting/underfitting detection)
Reviewed Changes
Copilot reviewed 11 out of 61 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| GaussianProcessesIntegrationTests.cs | Tests for Gaussian Process regression with various kernels and scenarios |
| FitnessCalculatorsBasicIntegrationTests.cs | Tests for MSE, MAE, RMSE, R², and loss functions (BCE, Hinge, Huber, etc.) |
| FitnessCalculatorsAdvancedIntegrationTests.cs | Tests for advanced loss functions (Focal, Dice, Jaccard, Contrastive, etc.) |
| FitDetectorsBasicIntegrationTests.cs | Tests for model fit detection including cross-validation and learning curves |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
User Story / Context
merge-dev2-to-masterSummary
Verification
Copilot Review Loop (Outcome-Based)
Record counts before/after your last push:
Files Modified
Notes