python - Optimal value is outside range when doing bruteforce optimization using Scipy -
i'm following example given in scipy's optimize documentation brute-force optimization on function 3 parameters.
this function wish optimize:
def entropy_of_hyperplane(z): w0, w1, b = z # calculations.. return -1 * ent to find global minimum of function using grid-serach, do:
def find_max_entropy_hyperplane(x): # grid-search on possible w in r^2 , b in r # , calculate entropy of each rranges = (slice(0, 2, 0.05), slice(0, 2, 0.05), slice(-4, 4, 0.25)) # ranges w0, w1, b resbrute = optimize.brute(entropy_of_hyperplane, rranges, full_output=true, finish=optimize.fmin) w0, w1, b = resbrute[0] print(w0, w1, b) and result is: w0 = 1.56; w1 = 1.1; b = 1842.73906893
what going on here? how optimal value of b outside range specified? can't understand behavior. appreciated!
Comments
Post a Comment