Functional API? *병렬구성이 필요하다고 생각할 때 사용*
->Sequential API는 여러 층을 공유하거나 다양한 종류의 입력과 출력을 사용하는 등의 복잡한 모델을 만드는 것
-> 중/고급
-> 각 레이어를 함수로 정의
from tensorflow.keras.layers import Input,Dense
from tensorflow.keras.models import Model
inputs = input(shape=(10,)) #입력층 반드시 정의 후 저장
hidden1 = Dense(16,activation='relu')(inputs) #입력층과 1번 히든레이어 결합
hidden2 = Dense(16,activation='relu)(hidden1) #1번과 2번 히든레이어 결합
output = Dense(1, activation='sigmoid')(hidden2) #2번 히든레이어와 출력층 결합
model = Model(inputs=inputs, outputs=output) #시작층과 마지막층을 지정해서 저장
Sequential API?
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
model = Sequential()
model.add(Dense(3, input_dim=4, activation ='softmax'))
'DeepLearning' 카테고리의 다른 글
DeepLearning - Tensorflow 활성화 함수 정리 (0) | 2022.10.29 |
---|---|
DeepLearning - Tensorflow 기초(텐서,변수,연산,문자열) (0) | 2022.10.29 |
DeepLearning - 인공 신경망 모델,weights 저장하기 (0) | 2022.10.28 |
DeepLearning - XOR문제 Greedy Layer-wise 트레이닝으로 풀기 (1) | 2022.10.28 |
DeepLearning - GREEDY LAYER-WISE Training (1) | 2022.10.28 |