Created
September 29, 2022 10:03
-
-
Save pthom/abb0e55c9ffda6a0043cdd0c0cf42b42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lambda_apriori_ratio_from_interval(value: float, interval: Interval) -> float: | |
""" | |
Returns 1 for a value at the center of the interval | |
Return 1.3 for a value at the border of the interval | |
i.e the values at the border are multiplied by 1.3 | |
(and are thus less likely to be a minimum) | |
""" | |
# x is between -0.5 and 0.5 (0 is the interval center) | |
x = math_utils.unlerp(interval.Min, interval.Max, value) - 0.5 | |
border_increase_ratio = 0.3 | |
anti_hat = 1. - math_utils.hat_width_1(x) | |
k = 1. + anti_hat * border_increase_ratio | |
return k | |
for v in src_values: | |
patch_comparison_result = lambda_patch_comparison_result_for_value(v) | |
diff_value_with_apriori = patch_comparison_result.mDiffValue * lambda_apriori_ratio_from_interval(v, value_search_interval) | |
diff_values.append(diff_value_with_apriori) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment