I have a list of thousands of couples of float values (reward, risk).
I want to extract the top couples, i.e. best reward with lowest risk.
Note to financial experts: it is a bit similar to an efficient frontier, but there is neither mean nor standard deviation. A sample of my data points with a representation of the cloud:
import numpy as np
import matplotlib.pyplot as plt
# first value is reward, second is risk
cloud = np.array([[1,2],[4,3],[5.5,2.3],[4,2],[3,3],[.9,1.9],[4,3],[4,3.2],[3,2.2],[2,2.6]])
plt.scatter(cloud[:,1], cloud[:, 0])
plt.xlabel("risk")
plt.ylabel("reward")
I expect an array with [.9, .9], [4, 2] and [5.5, 2.3]
I can do it with a loop, but it is not smart and may be not efficient...
I wrote a first attempt, not sure it is the best one.
If it can help anybody or be improved when dealing with large cloud of points: