Getting error in the output, scale is not defined, batch_size?
manisense opened this issue · 1 comments
Train a custom lightweight model on the Satellite data¶
import os
lr = 0.001
sat_model_filename = "lstm_att"
if os.path.exists('models'):
os.mkdir('models')
model_path = "models/{}.h5".format(sat_model_filename)
checkpoint = ModelCheckpoint(model_path, monitor='val_loss',
verbose=1, save_best_only=True, save_weights_only=False, mode='auto')
early = EarlyStopping(monitor='val_acc', min_delta=0.001, patience=10, verbose=0, mode='auto')
reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.5, patience=4, min_lr=0.0001)
file_path = "data/my_data.csv"
dropout = 0.5
layers = [256, 128]
batch_size = 256
n_steps = X_train.shape[1]
mdl = model_train(X_train, y_train, X_val, y_val, file_path, n_features = 14, n_steps = n_steps,
scale = scale, batch_size = batch_size, n_classes = 2,class_weights = None,
layers = layers, dropout = dropout, lr = lr)
y_pred = np.argmax(mdl.predict(X_test), axis = 1)
print(classification_report(np.argmax(y_test, axis = 1), y_pred, digits = 4))
NameError Traceback (most recent call last)
/tmp/ipykernel_7064/4009749044.py in
19 n_steps = X_train.shape[1]
20 mdl = model_train(X_train, y_train, X_val, y_val, file_path, n_features = 14, n_steps = n_steps,
---> 21 scale = scale, batch_size = batch_size, n_classes = 2,class_weights = None,
22 layers = layers, dropout = dropout, lr = lr)
23 y_pred = np.argmax(mdl.predict(X_test), axis = 1)
NameError: name 'scale' is not defined
Thanks for reporting this Elliot!
Please try setting scale
to a value, e.g. scale = 0.01
, either before calling the model_train
function, or by changing the corresponding parameter.
I will also update this in the repository soon.
Thanks,
George