from keras.models import Sequential from keras.layers import Dense model = Sequential([ Dense(64, activation='relu', input_shape=(100,)), Dense(1, activation='sigmoid') ])
from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D, Flatten, Dense model = Sequential([ Conv2D(32, (3,3), activation='relu', input_shape=(28,28,1)), MaxPooling2D((2,2)), Conv2D(64, (3,3), activation='relu'), MaxPooling2D((2,2)), Flatten(), Dense(64, activation='relu'), Dense(10, activation='softmax') ])The code above creates a sequential model with two convolutional layers followed by two max pooling layers. It then flattens the output and passes it through two fully connected (dense) layers, with the final layer using the softmax activation function for multiclass classification. In both examples, the keras.models Sequential package is imported and used to create sequential models by passing a list of layers as an argument. The models can then be trained and evaluated using the Keras API.