일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- cudnn
- mglearn
- KNeighborsClassifier
- tensorflow
- web 사진
- pycharm
- 대이터
- web 개발
- inorder
- CES 2O21 참여
- bccard
- CES 2O21 참가
- 재귀함수
- 머신러닝
- classification
- 웹 용어
- 자료구조
- 결합전문기관
- java역사
- web
- paragraph
- broscoding
- web 용어
- 데이터전문기관
- vscode
- Keras
- discrete_scatter
- html
- postorder
- C언어
- Today
- Total
목록분류 전체보기 (688)
bro's coding
#data_time을 이용해 요일 알아내기 data2.일자.dt.dayofweek data2['년']=data2.일자.dt.year data2['월']=data2.일자.dt.month data2['일']=data2.일자.dt.day data2['wday']=data2.일자.dt.weekday data2['wname']=data2.일자.dt.weekday_name # 0 : 월요일 data2.head() data2['요일']=data2.일자.dt.weekday.map({0:'월',1:'화',2:'수',3:'목',4:'금',5:'토',6:'일'}) data2.head()
import pandas as pd data=pd.read_csv('CARD_SUBWAY_MONTH_201905.csv') data data.pivot_table(values='승차총승객수',index='사용일자',columns='노선명',aggfunc='sum') # [사용일자:노선명] 에 따른 승차총승객수(sum)
data=pd.read_csv('CARD_SUBWAY_MONTH_201905.csv') data
# 꽃 이름에 따른 dictionary를 생성 label={i:iris.target_names[i] for i in range(3)} label # {0: 'setosa', 1: 'versicolor', 2: 'virginica'} # target number에 따라 꽃 이름을 mapping pd.Series(iris.target).map(label) 0 setosa 1 setosa 2 setosa 3 setosa 4 setosa 5 setosa 6 setosa 7 setosa 8 setosa 9 setosa 10 setosa 11 setosa 12 setosa 13 setosa 14 setosa 15 setosa 16 setosa 17 setosa 18 setosa 19 setosa 20 setosa ..
# target을 one-hot-incoding한다 import numpy as np import pandas as pd from sklearn.datasets import load_iris iris=load_iris() data=np.c_[iris.data,pd.get_dummies(iris.target).values] data array([[5.1, 3.5, 1.4, ..., 1. , 0. , 0. ], [4.9, 3. , 1.4, ..., 1. , 0. , 0. ], [4.7, 3.2, 1.3, ..., 1. , 0. , 0. ], ..., [6.5, 3. , 5.2, ..., 0. , 0. , 1. ], [6.2, 3.4, 5.4, ..., 0. , 0. , 1. ], [5.9, 3. , 5.1,..
from sklearn.manifold import TSNE import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import load_digits mnist=load_digits() tsne =TSNE() mnist_tsne=tsne.fit_transform(mnist.data) # 상대적인 거리를 이용해 가까운 것들은 더 가깝게, 먼 것들은 더 멀게 만든다. xmax, ymax = mnist_tsne.max(axis=0) xmin, ymin = mnist_tsne.min(axis=0) colors = ["#476A2A", "#7851B8", "#BD3430", "#4A2D4E", "#875525", "#A83683", "#4..
y=mnist.target.copy() y=np.where(y==9,1,0) ''' if(y==9): y=1 else: y=0 '''
from sklearn.neighbors import KNeighborsClassifier knn=KNeighborsClassifier(5) knn.fit(mnist.data,mnist.target) knn.score(mnist.data,mnist.target) # 0.9905397885364496
pca=PCA(2) X_pca=pca.fit_transform(mnist.data) plt.figure(figsize=[10,8]) plt.scatter(X_pca[:,0],X_pca[:,1],c=mnist.target) plt.colorbar() xmax,ymax=X_pca.max(axis=0) xmin,ymin=X_pca.min(axis=0) colors = ["#476A2A", "#7851B8", "#BD3430", "#4A2D4E", "#875525", "#A83683", "#4E655E", "#853541", "#3A3120", "#535D8E"] plt.figure(figsize=[14,14]) plt.xlim([xmin,xmax]) plt.ylim([xmin,xmax]) for i in ra..
import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import load_digits mnist=load_digits() display(mnist.keys()) display(dir(mnist)) plt.figure(figsize=[10,10]) for i in range(100): plt.subplot(10,10,i+1) plt.imshow(mnist.images[i],cmap='gray_r') plt.axis('off')