Comment on page
👷♂️ Numpy İşlemleri
Tüm işlemler
nparray
objesinin alt metotlarıdır.- Tüm operatör işlemlerini (
+
,/
...) destekler
Alt metodlar | Açıklama |
---|---|
<ndarray>.sum() | Elemanları toplama |
<ndarray>.sum(axis=<int> | Eksendeki elemanları toplama (0 = dikey 1 = yatay) |
<ndarray>.mean() | Ortalama |
np.dot(<ndarray>, <ndarray>) | Inner product (iç çarpım = x1.y1 + x2.y2 ... ) |
np.outher(<ndarray>, <ndarray>) | Outher product (matrix çarpımı) |
mat = np.random.rand(20, 10)mat.reshape(40, 5).shape # (40, 5)mat.reshape(30, 5) # Hata verir 200 öğe (30, 5)'e ayrılamazmat.ravel().shape # Düzleştirme (200,)mat.transpose().shape # (10, 20)
print(a) # [1 2 3 4 5]print(b) # [2 3 4 5 6]np.hstack((a, b))# array([1, 2, 3, 4, 5, 2, 3, 4, 5, 6])np.vstack((a, b))# array([[1, 2, 3, 4, 5],# [2, 3, 4, 5, 6]])np.dstack((a, b))# array([[[1, 2],# [2, 3],# [3, 4],# [4, 5],# [5, 6]]])
a_slice_prev = a_prev[0:2,0:2,:](m, n_H_prev, n_W_prev, n_C_prev) = A_prev.shape(f, f, n_C_prev, n_C) = W.shapefor a in depth: W = W[..., a]
fname = "images/thumbs_up.jpg"image = np.array(ndimage.imread(fname, flatten=False))my_image = scipy.misc.imresize(image, size=(64,64))plt.imshow(my_image)
Metod | Açıklama |
---|---|
dtype | Değişken tipi |
astype(<dtype>) | Tip değiştirme |
np.logspace(1, 10, 10).dtype # float64np.logspace(1, 10, 10).astype(int).dtype # int64
Last modified 27d ago