style patterns

This commit is contained in:
Miha Kralj
2026-01-25 16:01:45 -08:00
parent 2836f253c4
commit e59665c8f0
399 changed files with 6892 additions and 1323 deletions
+10 -3
View File
@@ -320,8 +320,15 @@ public class MapeTests
var actual = new TSeries();
var predicted = new TSeries();
for (int i = 0; i < 10; i++) actual.Add(DateTime.UtcNow, i + 1);
for (int i = 0; i < 5; i++) predicted.Add(DateTime.UtcNow, i + 1);
for (int i = 0; i < 10; i++)
{
actual.Add(DateTime.UtcNow, i + 1);
}
for (int i = 0; i < 5; i++)
{
predicted.Add(DateTime.UtcNow, i + 1);
}
Assert.Throws<ArgumentException>(() => Mape.Calculate(actual, predicted, 3));
}
@@ -386,4 +393,4 @@ public class MapeTests
// Over-prediction should have higher MAPE due to smaller denominator
Assert.True(overPrediction.Value > underPrediction.Value);
}
}
}
+5 -2
View File
@@ -52,7 +52,10 @@ public sealed class Mape : BiInputIndicatorBase
ValidateBatchInputs(actual, predicted, output, period);
int len = actual.Length;
if (len == 0) return;
if (len == 0)
{
return;
}
const int StackAllocThreshold = 256;
Span<double> percentErrors = len <= StackAllocThreshold
@@ -62,4 +65,4 @@ public sealed class Mape : BiInputIndicatorBase
ErrorHelpers.ComputePercentageErrors(actual, predicted, percentErrors, Epsilon);
ErrorHelpers.ApplyRollingMean(percentErrors, output, period);
}
}
}