일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- 웹 용어
- mglearn
- 데이터전문기관
- web 개발
- 대이터
- 재귀함수
- 자료구조
- CES 2O21 참가
- CES 2O21 참여
- html
- bccard
- web 용어
- 결합전문기관
- vscode
- discrete_scatter
- Keras
- tensorflow
- classification
- web
- paragraph
- pycharm
- KNeighborsClassifier
- C언어
- java역사
- postorder
- broscoding
- 머신러닝
- cudnn
- web 사진
- inorder
- Today
- Total
목록[IT]/python.numpy (11)
bro's coding
# 3 X 1080 X 1920 -> 1080 X 1920 X 3(moveaxis) X_train=np.moveaxis(X_train.reshape(-1,3,32,32),1,-1)
# score (np.argmax(pred_y,axis=1)==iris.target).mean()
import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import load_breast_cancer cancer = load_breast_cancer() X=cancer.data y=cancer.target plt.scatter(X[:,0],X[:,2]) plt.axis('equal') np.corrcoef(X[:,0],X[:,2]) array([[1. , 0.99785528], [0.99785528, 1. ]]) mat=np.corrcoef(X.T) mat plt.imshow(mat,vmin=-1,vmax=1,cmap='bwr') plt.colorbar() idx = [0, 2, 3, 12, 13, 20, 22, 23, 1, ..
y=mnist.target.copy() y=np.where(y==9,1,0) ''' if(y==9): y=1 else: y=0 '''
a = np.ones([4,3]) a ''' array([[1., 1., 1.], [1., 1., 1.], [1., 1., 1.], [1., 1., 1.]]) ''' a+[1,2,3] ''' [2,3,4] [2,3,4] [2,3,4] [2,3,4] ''' https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html Broadcasting — NumPy v1.17 Manual Broadcasting Note See this article for illustrations of broadcasting concepts. The term broadcasting describes how numpy treats arrays with different shapes d..
a = np.arange(12).reshape(4,3) a ''' array([[ 0, 1, 2], [ 3, 4, 5], [ 6, 7, 8], [ 9, 10, 11]]) ''' 1/a ''' array([[ inf, 1. , 0.5 ], [0.33333333, 0.25 , 0.2 ], [0.16666667, 0.14285714, 0.125 ], [0.11111111, 0.1 , 0.09090909]]) '''
import numpy as np a = np.array([1,2,3,4,5]) a+1 [2,3,4,5,6] a*4 [4,8,12,16,20]
import numpy as np iris_labels = ['Iris-setosa', 'Iris-versicolor', 'Iris-virginica'] iris = np.loadtxt('iris.csv', skiprows=1, delimiter=',', converters={4: lambda s: iris_labels.index(s.decode())}) # iris = np.loadtxt('iris.csv', skiprows=1, delimiter=',', # converters={4: lambda s: labels.index(s)}, encoding='utf-8') # latin1, ascii, utf-8, cp949