I was trying to get the minimum value between tr_loss and val_loss using numpy.min.
np.min(np.min(tr_loss), np.min(val_loss))
The tr_loss and val_loss are numpy arrays that returned from model.fit in keras.
'tr_loss': [0.84579472304284575, 0.77913203762769701, 0.76625978895127778, 0.75814685845822094, 0.75486504282504319, 0.74989902700781819, 0.74833822523653504, 0.74695981823652979, 0.74483485338091848, 0.74150521695762872]
'val_loss': [0.76307238261103627, 0.75163262798049202, 0.74257619685517573, 0.75038179922993964, 0.72936564083517463, 0.73233943380595634, 0.72518632964207708, 0.74037907492741795, 0.7237680551772061, 0.73257833277079065]}
But I keep getting this error
TypeError Traceback (most recent call last)
<ipython-input-35-e82cb24a3b5d> in <module>()
3
4
----> 5 y_ax_min = np.min(np.min(tr_loss), np.min(val_loss)) - .1
6 y_ax_max = np.max(np.max(tr_loss), np.max(val_loss)) + .1
7 plt.figure(figsize=(8, 8),dpi=500)
D:\Anaconda\envs\py27\lib\site-packages\numpy\core\fromnumeric.pyc in
amin(a, axis, out, keepdims)
2347 pass
2348 else:
-> 2349 return amin(axis=axis, out=out, **kwargs)
2350
2351 return _methods._amin(a, axis=axis,
D:\Anaconda\envs\py27\lib\site-packages\numpy\core\_methods.pyc in _amin(a,
axis, out, keepdims)
27
28 def _amin(a, axis=None, out=None, keepdims=False):
---> 29 return umr_minimum(a, axis, None, out, keepdims)
30
31 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):
TypeError: 'numpy.float64' object cannot be interpreted as an index
Does anyone know where is the problem?
help(numpy.min). You aren't calling it as intended. The second argument should be an axis. It's not like the built inminfunction.numpy.minimumshould be used instead ofnumpy.min. @ChrisP Thanks.