def best_guess(f,X):
    '''
    Gets the best current guess from a vector.
    :param f: function to evaluate.
    :param X: locations.
    '''
    n = X.shape[0]
    xbest = np.zeros(n)
    for i in range(n):
        ff = f(X[0:(i+1)])
        xbest[i] = ff[np.argmin(ff)]
    return xbest
def best_guess ( f , X ) : n = X . shape [ 0 ] xbest = np . zeros ( n ) for i in range ( n ) : ff = f ( X [ 0 : ( i + 1 ) ] ) xbest [ i ] = ff [ np . argmin ( ff ) ] return xbest
Gets the best current guess from a vector.
    :param f: function to evaluate.
    :param X: locations.