[numpy] transpose, linalg.inv, dot
import numpy as np transpose test = np.array([0,1,2],[3,4,5]) result = test.transpose() transpose 전치행렬을 구하는 함수로 행렬의 (i,j)번째 원소를 (j,i) 번째 원소로 바꿔 줍니다. test : [0,1,2] [3,4,5] result: [0,3] [1,4] [2,5] linalg.inv test = np.array([0,1],[2,3]) result = np.linalg.inv(test) 역행렬을 구할 때 사용합니다. dot test1 = np.array([0,1,2],[3,4,5]) test2 = np.array([3,4],[5,6],[7,8]) result = np.dot(test1,test2) 내적을 구할 때 사용..
2020. 10. 4.
[numpy] array, reshape concatenate, split
import numpy as np numpy 를 np 로 불러온다. array test = np.array([1,2,3],[4,5,6]) [1,2,3] [4,5,6] 형태의 행렬 만들어짐 reshape test1 = test.reshape(3,2) [1,2] [3,4] [5,6] 과 같이 바뀜 행렬의 모양을 바꿔주는 함수 concatenate test1 = np.array([[1, 2], [3, 4]]) test2 = np.array([[5, 6], [7, 8]]) result1 = numpy.concatenate((A, B), axis = 0) result2 = numpy.concatenate((A, B), axis = 1) concatenate는 두 개의 array를 합치는 함수이다. axis=0 인..
2020. 10. 4.