我正在从事有关深度学习的项目。我有一个形状为(101,3)的数组,并输出为形状(101,3)。这意味着输入数据中的每一行都与输出数据中的同一行相关。我的目的是创建用于迁移数据集的深度学习模型。我进行了一些研究,并找到了一些有关此示例。其中一个是link。据我了解,我需要许多模型,但我不知道如何创建它。请你能帮我一下吗?我如何创建此模型,或者您有什么建议的资源。
答案 0 :(得分:1)
您可以根据网络性能使用类似的内容,
from tensorflow.keras.layers import RepeatVector, TimeDistributed, Dense, LSTM
from tensorflow.keras.models import *
model = Sequential()
# encoder layer
model.add(LSTM(100, activation='relu', return_sequences= True, input_shape=(101, 3)))
# decoder layer
model.add(LSTM(100, activation='relu', return_sequences=True))
model.add(TimeDistributed(Dense(3)))
model.compile(optimizer='adam', loss='mse')
print(model.summary())
答案 1 :(得分:1)
您可以使用以下方法。请从此tutorial开始您的旅程。您可以删除下面的某些图层或添加更多的图层,以查看结果如何变化。
model = tf.keras.models.Sequential([
tf.keras.layers.Dense(128, activation='relu',input_shape=(3,)),
tf.keras.layers.Dense(64, activation='relu'),
tf.keras.layers.Dense(32, activation='relu'),
tf.keras.layers.Dense(3)
])
Model: "sequential_3"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
dense_6 (Dense) (None, 128) 512
_________________________________________________________________
dense_7 (Dense) (None, 64) 8256
_________________________________________________________________
dense_8 (Dense) (None, 32) 2080
_________________________________________________________________
dense_9 (Dense) (None, 3) 99
=================================================================
Total params: 10,947
Trainable params: 10,947
Non-trainable params: 0
_________________________________________________________________