1.how to build layers
-
Manually(1x3matrix)
点击查看代码
x = np.arrat([200.0, 17.0]) layer_1 = Dense(units=3, activation='sigmoid') a1 = layer_1(x) layer_2 = Dense(units=1, activation='sigmoid') a2 = layer_2(a1) #a1&a2 are stored in TensorFlow format. Run this to convert it to NumPy: a1.numpy().
-
Automatically
点击查看代码
layer_1 = Dense(units=3, activation='sigmoid') layer_2 = Dense(units=1, activation='sigmoid') model = Sequential([layer_1, layer_2])
-
Compile the model
点击查看代码
model.compile(...) x = np.array([...]) y = np.array([...]) model.fit(x,y) model.predict(x_test)
-
All
点击查看代码
model = Sequential([Dense(units=25, activation='sigmoid'),Dense(units=15, activation='sigmoid'),Dense(units=1, activation='sigmoid')]) model.compile(...) x = np.array([...]) y = np.array([...]) model.fit(x,y) model.predict(x_test)