I am attempting to define an optimization for the following problem: given a graph find the largest interval(s) where
S > S_th (the narrower the interval the smaller
S will be) and
P < P_th (the wider the interval the higher
P will be).
- I am not 100% certain the claims in parenthesis are always correct as, I think, it is affected by the distance between the
G is KDEs generated with Gaussian functions, therefore continuous.
I already know that the conditions can be true only where the
Red graph is above the
Green one. I, therefore, find the intersections between the graphs (e.g. with brentq) and find relevant intervals by calculation a single point in them.
Below are a few examples of graphs I want to analyze. The blue vertical lines mark graph intersections; blue horizontal lines with the condition results on top are shown only when the conditions were met for the whole interval.
The vertical and horizontal lines in black are generated from an ML algorithm which I want to replace with a numerical calculation. As it can be seen it, usually, finds intervals that are smaller than the whole area where red is on top.
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