Warum zeigt mein Keras -Modell 4 Parameter anstelle von 2?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Warum zeigt mein Keras -Modell 4 Parameter anstelle von 2?

by Anonymous » 28 Feb 2025, 05:18

Ich trainiere ein einfaches Kerasmodell mit einer dichten Ebene, aber wenn ich Modell nenne.import tensorflow as tf
import numpy as np

# Generate dummy data
X_train = np.random.rand(40) # Shape (40,)
y_train = np.random.rand(40)

# Define a simple model
model = tf.keras.Sequential([
tf.keras.layers.Dense(1)
])

# Compile the model
model.compile(loss=tf.keras.losses.mae,
optimizer=tf.keras.optimizers.SGD(),
metrics=["mae"])

# Train the model
model.fit(tf.expand_dims(X_train, axis=-1), y_train, epochs=100)

# Check model summary
model.summary()
< /code>
Da dicht (1) 1 Gewicht + 1 -Bias haben sollte, erwartete ich 2 Parameter, nicht 4. Ergebnis:

Top