res_DE=differential_evolution(invSortino,bounds=bounds, disp=True)
where invSortino takes an iterable of length x ad returns a negative scalar.
bounds are defined by
lb=[1e-03]*data.shape[1]
ub=[.4]*data.shape[1]
bounds=Bounds(lb,ub)
Or
#bounds=[(0,.4)]*data.shape[1]
the length of bounds is correct,(method 2 above)
but iterable generated has a length 0
print('shapes: ',weights.shape,data.shape)
results in
shapes: (0,) (951, 65)
which results in the error
Traceback (most recent call last):
File "C:\Users\anaconda3\lib\site-packages\scipy\optimize\_differentialevolution.py", line 878, in _calculate_population_energies
parameters_pop[0:nfevs]))
File "C:\Users\anaconda3\lib\site-packages\scipy\optimize\_differentialevolution.py", line 1265, in __call__
return self.f(x, *self.args)
File "c:/Users/try.py", line 68, in invSortino
rets=data*weights
File "C:\Users\anaconda3\lib\site-packages\pandas\core\ops\__init__.py", line 695, in f
other = _align_method_FRAME(self, other, axis)
File "C:\Users\anaconda3\lib\site-packages\pandas\core\ops\__init__.py", line 644, in _align_method_FRAME
right = to_series(right)
File "C:\Users\anaconda3\lib\site-packages\pandas\core\ops\__init__.py", line 636, in to_series
msg.format(req_len=len(left.columns), given_len=len(right))
ValueError: Unable to coerce to Series, **length must be 65: given 0**
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
line 85, in <module>
res_DE=differential_evolution(invSortino,bounds=bounds, disp=True)
File "C:\Users\anaconda3\lib\site-packages\scipy\optimize\_differentialevolution.py", line 306, in differential_evolution
ret = solver.solve()
File "C:\Users\anaconda3\lib\site-packages\scipy\optimize\_differentialevolution.py", line 745, in solve
self.population[self.feasible]))
File "C:\Users\anaconda3\lib\site-packages\scipy\optimize\_differentialevolution.py", line 883, in _calculate_population_energies
raise RuntimeError("The map-like callable must be of the"
RuntimeError: The map-like callable must be of the form f(func, iterable), returning a sequence of numbers the same length as 'iterable'