-
Notifications
You must be signed in to change notification settings - Fork 0
/
keras17_summary.py
53 lines (46 loc) · 2.15 KB
/
keras17_summary.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
# 1. 데이터
x = np.array([1, 2, 3])
y = np.array([1, 2, 3])
#2. 모델구성(인공신경망)
model = Sequential() #순차적 모델
model.add(Dense(5, input_dim=1, activation='linear',)) #dam 1개 차원
model.add(Dense(30, activation='linear')) # 모델 수 hidden layer
model.add(Dense(30))# 모델 수 hidden layer
model.add(Dense(30))# 모델 수 hidden layer
model.add(Dense(30))# 모델 수 hidden layer
model.add(Dense(40))# 모델 수 hidden layer
model.add(Dense(40))# 모델 수 hidden layer
model.add(Dense(1))
model.summary()
'''
Model: "sequential"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
dense (Dense) (None, 5) 10
_________________________________________________________________
dense_1 (Dense) (None, 30) 180
_________________________________________________________________
dense_2 (Dense) (None, 30) 930
_________________________________________________________________
dense_3 (Dense) (None, 30) 930
_________________________________________________________________
dense_4 (Dense) (None, 30) 930
_________________________________________________________________
dense_5 (Dense) (None, 40) 1240
_________________________________________________________________
dense_6 (Dense) (None, 40) 1640
_________________________________________________________________
dense_7 (Dense) (None, 1) 41
=================================================================
Total params: 5,901
Trainable params: 5,901
Non-trainable params: 0
'''
# 실습2 + 과제
#ensemble 1, 2, 3, 4에 대해 서머리를 계산하고 이해한 것을 과제로 제출할 것
#layer을 만들 때 'name'에 대해 확인하고 설명할 것 name을 반드시 써야할 때가 있나?