Running the scipy.minimize function "I get TypeError: 'numpy.float64' object is not callable". Specifically during the execution of:
.../scipy/optimize/optimize.py", line 292, in function_wrapper
return function(*(wrapper_args + args))
I already looked at previous similar topics here and usually this problem occurs due to the fact that as first input parameter of .minimize is not a function. I have difficulties in figure it out, because "a" is function. What do you think?
### "data" is a pandas data frame of float values
### "w" is a numpy float array i.e. [0.11365704 0.00886848 0.65302202 0.05680696 0.1676455 ]
def a(data, w):
### Return a negative float value from position [2] of an numpy array of float values calculated via the "b" function i.e -0.3632965490830499
return -b(data, w)[2]
constraint = ({'type': 'eq', 'fun': lambda x: np.sum(x) - 1})
### i.e ((0, 1), (0, 1), (0, 1), (0, 1), (0, 1))
bound = tuple((0, 1) for x in range (len(symbols)))
opts = scipy.minimize(a(data, w), len(symbols) * [1. / len(symbols),], method = 'SLSQP', bounds = bound, constraints = constraint)