Home [Tensorflow] Wide&Deep, Deep&Cross 모델 생성
Post
Cancel

[Tensorflow] Wide&Deep, Deep&Cross 모델 생성

Wide & Depp

1
2
3
4
5
6
7
8
wide = layers.BatchNormalization()(wide)
for units in hidden_units:
    deep = layers.Dense(units)(deep)
    deep = layers.BatchNormalization()(deep)
    deep = layers.ReLU()(deep)
    deep = layers.Dropout(dropout)(deep)
merged = layers.concatenate([wide, deep])
return layers.Dense(1, activation='sigmoid')(merged)

Deep & Cross

1
2
3
4
5
6
7
8
9
10
11
12
13
cross = deep
for _ in hidden_units:
    units = cross.shape[-1]
    x = layers.Dense(units)(cross)
    cross = deep * x + cross
cross = layers.BatchNormalization()(cross)
for units in hidden_units:
    deep = layers.Dense(units)(deep)
    deep = layers.BatchNormalization()(deep)
    deep = layers.ReLU()(deep)
    deep = layers.Dropout(dropout)(deep)
merged = layers.concatenate([cross, deep])
model = layers.Dense(1, activation='sigmoid')(merged)
This post is licensed under CC BY 4.0 by the author.

[Tensorflow] DNN 모델

[Git] Passwd가 아닌 Token 방식으로 변경