proof-of-portfolio 0.0.103__py3-none-any.whl → 0.0.105__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- proof_of_portfolio/_version.py +1 -1
- proof_of_portfolio/circuits/components/src/core/omega.nr +27 -14
- proof_of_portfolio/circuits/target/circuits.json +1 -1
- proof_of_portfolio/circuits/vk/vk +0 -0
- {proof_of_portfolio-0.0.103.dist-info → proof_of_portfolio-0.0.105.dist-info}/METADATA +1 -1
- {proof_of_portfolio-0.0.103.dist-info → proof_of_portfolio-0.0.105.dist-info}/RECORD +9 -9
- {proof_of_portfolio-0.0.103.dist-info → proof_of_portfolio-0.0.105.dist-info}/WHEEL +0 -0
- {proof_of_portfolio-0.0.103.dist-info → proof_of_portfolio-0.0.105.dist-info}/entry_points.txt +0 -0
- {proof_of_portfolio-0.0.103.dist-info → proof_of_portfolio-0.0.105.dist-info}/top_level.txt +0 -0
proof_of_portfolio/_version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# This file is auto-generated during build
|
2
|
-
__version__ = "0.0.
|
2
|
+
__version__ = "0.0.105"
|
@@ -18,8 +18,8 @@ pub fn omega(
|
|
18
18
|
if use_weighting {
|
19
19
|
let mut product_sum_positive: i64 = 0;
|
20
20
|
let mut product_sum_negative: i64 = 0;
|
21
|
-
let mut
|
22
|
-
let mut
|
21
|
+
let mut sum_weights_positive_raw: i64 = 0;
|
22
|
+
let mut sum_weights_negative_raw: i64 = 0;
|
23
23
|
|
24
24
|
for i in 0..ARRAY_SIZE {
|
25
25
|
if (i as u32) < actual_len {
|
@@ -27,31 +27,44 @@ pub fn omega(
|
|
27
27
|
let log_return = log_returns[i];
|
28
28
|
if log_return > 0 {
|
29
29
|
product_sum_positive += log_return * weight;
|
30
|
-
|
30
|
+
sum_weights_positive_raw += weight;
|
31
31
|
} else {
|
32
32
|
product_sum_negative += log_return * weight;
|
33
|
-
|
33
|
+
sum_weights_negative_raw += weight;
|
34
34
|
}
|
35
35
|
}
|
36
36
|
}
|
37
37
|
|
38
|
-
|
39
|
-
|
38
|
+
// Apply max with omega_loss_min like in Python reference
|
39
|
+
let sum_weights_positive = if sum_weights_positive_raw >= omega_loss_min {
|
40
|
+
sum_weights_positive_raw
|
40
41
|
} else {
|
41
|
-
|
42
|
+
omega_loss_min
|
42
43
|
};
|
43
|
-
let
|
44
|
-
|
44
|
+
let sum_weights_negative = if sum_weights_negative_raw >= omega_loss_min {
|
45
|
+
sum_weights_negative_raw
|
45
46
|
} else {
|
46
|
-
|
47
|
+
omega_loss_min
|
47
48
|
};
|
48
49
|
|
49
|
-
|
50
|
-
|
50
|
+
// Apply cross-multiplication with scaling to prevent overflow
|
51
|
+
// Scale down both factors before multiplication, then scale back up
|
52
|
+
let scale_down = SCALE / 1000; // Scale down by 1000 to prevent overflow
|
53
|
+
let product_sum_positive_scaled = product_sum_positive / scale_down;
|
54
|
+
let product_sum_negative_scaled = product_sum_negative / scale_down;
|
55
|
+
|
56
|
+
let positive_sum_weighted = product_sum_positive_scaled * sum_weights_negative;
|
57
|
+
let negative_sum_weighted = product_sum_negative_scaled * sum_weights_positive;
|
58
|
+
|
59
|
+
let effective_denominator = if (-negative_sum_weighted) >= (omega_loss_min / scale_down) {
|
60
|
+
-negative_sum_weighted
|
51
61
|
} else {
|
52
|
-
omega_loss_min
|
62
|
+
omega_loss_min / scale_down
|
53
63
|
};
|
54
|
-
|
64
|
+
|
65
|
+
// Apply scale_down correction to RATIO_SCALE_FACTOR
|
66
|
+
let adjusted_ratio_scale = RATIO_SCALE_FACTOR * scale_down;
|
67
|
+
(positive_sum_weighted * adjusted_ratio_scale) / effective_denominator
|
55
68
|
} else {
|
56
69
|
let mut positive_sum: i64 = 0;
|
57
70
|
let mut negative_sum: i64 = 0;
|