We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd397b4 commit 8dbb5b6Copy full SHA for 8dbb5b6
4 files changed
experiments/src/pricing_fun.scala
@@ -5,14 +5,13 @@ import cats.syntax.all.*
5
6
@main def pricingFun =
7
8
- val iterations = Array(1,1,2,3,1,2,3,4,5,10,10,10,10,10).sorted
9
- val days = Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14)
10
- val amounts = Array(20.0,0,0,0,Int.MaxValue,0,0,0,0,0,25,30,0,0)
+ val iterations = Array(1, 1, 2, 3, 1, 2, 3, 4, 5, 10, 10, 10, 10, 10).sorted
+ val days = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
+ val amounts = Array(20.0, 0, 0, 0, Int.MaxValue, 0, 0, 0, 0, 0, 25, 30, 0, 0)
11
12
println(iterations.printArr)
13
println(amounts.printArr)
14
15
-
16
val scen = Scenarr(
17
iterations = iterations,
18
days = days,
@@ -33,3 +32,4 @@ import cats.syntax.all.*
33
32
splits10.map(_.cededToLayer).foreach(arr => println(arr.printArr))
34
35
splits.map(s => s.lossReport(scen.numberIterations, scen.iterations, ReportDenominator.FirstLimit)).ptbln
+end pricingFun
vecxt_re/src-js-native/PlatformReporting.scala
@@ -8,8 +8,8 @@ object PlatformReporting:
/** Computes loss report metrics in a single pass using Welford's online algorithm.
*
- * Instead of calling groupSum multiple times (for attachment, exhaustion, std, and EL), this method iterates
- * through the grouped sums once, accumulating all intermediate results:
+ * Instead of calling groupSum multiple times (for attachment, exhaustion, std, and EL), this method iterates through
+ * the grouped sums once, accumulating all intermediate results:
* - Sum for expected loss (EL)
* - Count of attached iterations (groupSum > 0)
* - Count of exhausted iterations (groupSum >= exhaust threshold)
@@ -63,9 +63,11 @@ object PlatformReporting:
63
64
// Update attachment count (any positive loss)
65
if groupSum > 0 then attachCount += 1
66
+ end if
67
68
// Update exhaustion count
69
if groupSum > exhaust then exhaustCount += 1
70
71
72
// Welford's online algorithm for variance
73
n += 1
@@ -93,4 +95,4 @@ object PlatformReporting:
93
95
exhaustProb = exhaustProb
94
96
)
97
end lossReportFast
-end PlatformReporting
98
+end PlatformReporting
vecxt_re/src-jvm/PlatformReporting.scala
@@ -3,15 +3,15 @@ package vecxt_re
3
/** Platform-specific reporting implementations for JVM.
4
* Uses a streaming single-pass algorithm to compute all loss metrics efficiently. The algorithm processes groups
- * inline (avoiding the allocation of an intermediate array) and uses Welford's online algorithm for numerically
- * stable variance computation.
+ * inline (avoiding the allocation of an intermediate array) and uses Welford's online algorithm for numerically stable
+ * variance computation.
*/
object PlatformReporting:
@@ -65,9 +65,11 @@ object PlatformReporting:
74
75
@@ -95,4 +97,4 @@ object PlatformReporting:
99
100
vecxt_re/test/src/attachment.test.scala
0 commit comments