Model Pipeline - Sequential model API
The Sequential model API in TensorFlow helps us build a simple stack of layers for machine learning. We add layers one after another, and the model learns to make predictions from input data.
Jump into concepts and practice - no test required
The Sequential model API in TensorFlow helps us build a simple stack of layers for machine learning. We add layers one after another, and the model learns to make predictions from input data.
Loss
0.7 |****
0.6 |***
0.5 |**
0.4 |*
0.3 |*
1 2 3 4 5 Epochs| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 0.65 | 0.60 | Model starts learning, loss is high, accuracy is low |
| 2 | 0.50 | 0.75 | Loss decreases, accuracy improves |
| 3 | 0.40 | 0.82 | Model continues to learn well |
| 4 | 0.35 | 0.86 | Loss decreases steadily, accuracy increases |
| 5 | 0.30 | 0.89 | Good convergence, model is improving |
Sequential model API in TensorFlow?from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
model = Sequential([
Dense(5, input_shape=(10,)),
Dense(3)
])
print(model.output_shape)from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense model = Sequential() model.add(Dense(10, input_shape=(5,))) model.add(Dense(1)) model.compile(optimizer='adam', loss='mse') model.fit(x_train, y_train, epochs=5)
x_train and y_train in model.fit() but they are not defined anywhere, causing a runtime error.