Did I find the right examples for you? yes no

# numpy.argmin

All Samples(1090)  |  Call(1022)  |  Derive(0)  |  Import(68)
```Return the indices of the minimum values along an axis.

--------
argmax : Similar function.  Please refer to `numpy.argmax` for detailed
documentation.
```

```        def argmin(a, axis=None):
"""
Return the indices of the minimum values along an axis.

--------
argmax : Similar function.  Please refer to `numpy.argmax` for detailed
documentation.

"""
try:
argmin = a.argmin
except AttributeError:
return _wrapit(a, 'argmin', axis)
return argmin(axis)
```

```    x[:, 8:, 2] = -1
unaries = x + 1.5 * np.random.normal(size=x.shape)
x = np.argmin(x, axis=2)
unaries = (unaries * 10).astype(np.int32)
x_thresh = np.argmin(unaries, axis=2)
```

```    plt.imshow(img2)
plt.subplot(233, xticks=(), yticks=())
plt.imshow(np.argmin(unaries, axis=2), interpolation='nearest')
plt.subplot(223, xticks=(), yticks=())
plt.imshow(potts_cut.reshape(newshape), interpolation='nearest')
```

```print results
print 'best result for k, by AIC, BIC, R2_adj, L1O'
print np.r_[(np.argmin(results[:,1:3],0), np.argmax(results[:,3],0),
np.argmin(results[:,-1],0))]

```

```print results
print 'best result for k, by AIC, BIC, R2_adj, L1O'
print np.r_[(np.argmin(results[:,1:3],0), np.argmax(results[:,3],0),
np.argmin(results[:,-1],0))]

```

```	c1 = ax.contour(widths, stages, err[0], lev/10, cmap=plt.cm.Greys_r)
c2 = ax.contour(widths, stages, err[1], lev, cmap=plt.cm.Reds_r)
ax.plot(widths[:, 0], stages[0, np.argmin(err[0], 1)], "ko")
ax.plot(widths[:, 0], stages[0, np.argmin(err[1], 1)], "ro")
print(widths[:, 0], stages[0, np.argmin(err[0], 1)],
stages[0, np.argmin(err[1], 1)])
```

```print(results)
print('best result for k, by AIC, BIC, R2_adj, L1O')
print(np.r_[(np.argmin(results[:,1:3],0), np.argmax(results[:,3],0),
np.argmin(results[:,-1],0))])

```

```    fidx[0] = f_first
for i in range(1,fidx.size):
fidx[i] = np.argmin(np.abs(f_scaled - bandedges[i])) + f_first
if i > 0:
d = fidx[i]-fidx[i-1]
```

```idx = np.sum(gtab.bvecs, axis=-1) == 0
gtab.bvecs[idx] = np.inf
axis_X = np.argmin(np.sum((gtab.bvecs-np.array([1, 0, 0]))**2, axis=-1))
axis_Y = np.argmin(np.sum((gtab.bvecs-np.array([0, 1, 0]))**2, axis=-1))
axis_Z = np.argmin(np.sum((gtab.bvecs-np.array([0, 0, 1]))**2, axis=-1))
```

```
# min loss according to OOB
oob_best_iter = x[np.argmin(cumsum)]

# min loss according to test (normalize such that first loss is 0)
test_score -= test_score[0]
test_best_iter = x[np.argmin(test_score)]
```
```# min loss according to cv (normalize such that first loss is 0)
cv_score -= cv_score[0]
cv_best_iter = x[np.argmin(cv_score)]

# color brew for the three curves
```

```