Keras

Step 1: Sequential model

from keras.models import Sequential
model = Sequential()

Step 2: add layers

from keras.layers import Dense
model.add(Dense(units=64, activation='relu', input_dim=100))
model.add(Dense(units=10, activation='softmax'))

Step 3: Compile model

model.compile(loss='categorical_crossentropy', optimizer='sgd',metrics=['accuracy'])

Step 4: Train model with data

# x_train and y_train are Numpy arrays --just like in the Scikit-Learn API.
model.fit(x_train, y_train, epochs=5, batch_size=32)

Step 5: Evaluate

loss_and_metrics = model.evaluate(x_test, y_test, batch_size=128)

Step 6: Predict with the model

classes = model.predict(x_test, batch_size=128)

results matching ""

    No results matching ""