I am using scipy's brute optimizer to compute the scores of a function given different input parameters. In order to analyze the results, I want to dump the resulting parameter vs score sets into a csv.
What I currently have is the return from the brute optimizer, which from the docs is of the form:
Returns:
x0 : ndarray
A 1-D array containing the coordinates of a point at which the objective function had its minimum value. (See Note 1 for which point is returned.)
fval : float
Function value at the point x0.
grid : tuple
Representation of the evaluation grid. It has the same length as x0. (Returned when full_output is True.)
Jout : ndarray
Function values at each point of the evaluation grid, i.e., Jout = func(*grid). (Returned when full_output is True.)
I want combine the "grid" value with the "Jout" parameter in the form of:
[Param1,Param2,Param3,Score1]
[Param1,Param2,Param3,Score2]
...
An example output from brute is:
(array([ 0., 0., 0.]), -0.96868449202047968, array([[[[0, 0],
[0, 0]],
[[1, 1],
[1, 1]]],
[[[0, 0],
[1, 1]],
[[0, 0],
[1, 1]]],
[[[0, 1],
[0, 1]],
[[0, 1],
[0, 1]]]]), array([[[-0.96868449, -0.96868449],
[-0.96868449, -0.96868449]],
[[-0.96868449, -0.96868449],
[-0.96868449, -0.96868449]]]))
I cannot, for the life of me figure out how to combine the array in index 2 of above (the "grid") with the array in index 3 (the "Jout"). My np array foo is not up to snuff.
Any tips or pointers would be very appreciated and ease my frustrated brain of the last few hours.