我是 Keras 新手,从 tf 教程中的代码开始:
# choosing the layers of my models
model = keras.Sequential([ # the sequential model of Keras library
keras.layers.Flatten(input_shape=(28, 28)), # the first input layer
keras.layers.Dense(128, activation='relu'),# the hidden layer
keras.layers.Dense(10)# output layers and 10 corresponds to the number of used classes
])
我想知道 128 是什么值?以及它是如何计算的?
最佳答案
它不是计算出来的,而是一个超参数(不是由数据估计的参数,而是由您在运行模型之前选择的)。它本质上决定了模型的复杂性。神经元越多,它可以在数据中建模的关系就越复杂。
关于python - 如何选择 tf.keras 模型隐藏层输出神经元的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60210852/