Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error in the output, scale is not defined, batch_size? #4

Open
manisense opened this issue Apr 1, 2023 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@manisense
Copy link

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

@gchoumos gchoumos self-assigned this Apr 1, 2023
@gchoumos gchoumos added the bug Something isn't working label Apr 1, 2023
@gchoumos
Copy link
Member

gchoumos commented Apr 1, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants