반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Keras
- 머신러닝
- vscode
- postorder
- 결합전문기관
- 대이터
- html
- broscoding
- KNeighborsClassifier
- classification
- pycharm
- web 사진
- 웹 용어
- web 개발
- java역사
- web 용어
- CES 2O21 참여
- inorder
- web
- bccard
- mglearn
- C언어
- paragraph
- 데이터전문기관
- tensorflow
- 자료구조
- discrete_scatter
- cudnn
- 재귀함수
- CES 2O21 참가
Archives
- Today
- Total
bro's coding
keras.layers.Dropout 본문
반응형
# drop out : 뉴런 몇개를 막아버린다.
(X_train,y_train),(X_test,y_test)=mnist.load_data()
X_train=X_train/255
X_test=X_test/255
y_train=np.eye(10)[y_train]
y_test=np.eye(10)[y_test]
from keras.layers import Dropout
from keras.layers import Flatten
model=Sequential()
model.add(Flatten(input_shape=(28,28)))
model.add(Dense(128,activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(256,activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(256,activation='relu'))
model.add(Dense(10,activation='softmax'))
model.summary()
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
flatten_8 (Flatten) (None, 784) 0
_________________________________________________________________
dense_62 (Dense) (None, 128) 100480
_________________________________________________________________
dropout_7 (Dropout) (None, 128) 0
_________________________________________________________________
dense_63 (Dense) (None, 256) 33024
_________________________________________________________________
dropout_8 (Dropout) (None, 256) 0
_________________________________________________________________
dense_64 (Dense) (None, 256) 65792
_________________________________________________________________
dense_65 (Dense) (None, 10) 2570
=================================================================
Total params: 201,866
Trainable params: 201,866
Non-trainable params: 0
_________________________________________________________________
# score test
pred_y_test=model.predict(X_test)
(pred_y_test*y_test).sum()/len(y_test)
0.1004556488275528
반응형
'[AI] > python.keras' 카테고리의 다른 글
keras.workflow (0) | 2020.08.10 |
---|---|
keras.classifier.cifar10 (0) | 2020.06.13 |
머신러닝 용어집 (0) | 2020.06.09 |
distinguish dog and cat (0) | 2020.06.09 |
keras.layers.Flatten (0) | 2020.05.13 |
keras.save (0) | 2020.05.13 |
keras.score (0) | 2020.05.13 |
keras.mnist(중간층) (0) | 2020.05.13 |
Comments