I am attempting to define an optimization for the following problem: given two graphs find (the largest possible) areas where some condition holds.
Interesting portions are where the
Red graph is above the
Green one. All, or part, of such areas may satisfy the condition.
Googling for optimization algorithms, e.g. ones mentioned in Scipy’s optimization tutorial, returns results focusing on finding a single point, usually the min/max of some condition. I am having trouble finding algorithms that search for ranges.
G are KDEs generated with Gaussian functions. I can find the intersections of the graphs (e.g. with brentq and between each pair calculate
S (the conditions). The blue vertical lines are the intersections; blue horizontal lines with text are shown only when the conditions were met for the whole range.
In many cases a subset of the range satisfies the condition as can be seen in black. Those are results from a ML algorithm which I want to replace with a numerical calculation.
Example 1: ML algo found better solution on the right section, neither found the left one interesting.
Example 2: on the right you can see the ML algo suggesting a range not quite between the blue lines. I am OK with the new algo clipping the portion on the left. Example 3: showing that there may be more than one interesting range per marked section. Example 4: ML algo missed the leftmost range