Edge Impulse Docs

Edge Impulse Documentation

Welcome to the Edge Impulse documentation. You'll find comprehensive guides and documentation to help you start working with Edge Impulse as quickly as possible, as well as support if you get stuck. Let's jump right in!

Reducing the learning rate


Expert mode

This only applies to Keras blocks in expert mode. In visual (simple) mode you can just change the learning rate in the UI.

If your model is overfitting (or takes a very long time to fit) you can change the learning rate of your model:

from keras.models import Sequential
from keras.layers import Dense, InputLayer, Dropout
from keras.optimizers import Adam
from keras import regularizers

r = regularizers.l1(0.00001)

model = Sequential()
model.add(InputLayer(input_shape=(X_train.shape[1], ), name='x_input'))
model.add(Dense(20, activation='relu', activity_regularizer=r ))
model.add(Dense(10, activation='relu', activity_regularizer=r ))
model.add(Dense(classes, activation='softmax', name='y_pred'))

# this reduces the learning rate by 100 (default is 0.001)
opt = Adam(lr=0.00001, beta_1=0.9, beta_2=0.999) 

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

model.fit(X_train, Y_train, batch_size=50, epochs=100, validation_data=(X_test, Y_test))

Updated 6 months ago

Reducing the learning rate

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.