Skip to content

Instantly share code, notes, and snippets.

@adhadse
Created May 23, 2021 10:58
Show Gist options
  • Select an option

  • Save adhadse/6f029b41ee8dae04512354e7351fee14 to your computer and use it in GitHub Desktop.

Select an option

Save adhadse/6f029b41ee8dae04512354e7351fee14 to your computer and use it in GitHub Desktop.
model.compile(loss="mse", optimizer=keras.optimizers.SGD(lr=1e-3))
# Splitting the train, test and validation data
# for different sets of featrues
X_train_A, X_train_B = X_tain[:, :5], X_train[:, 2:]
X_valid_A, X_valid_B = X_valid[:, :5], X_valid[:, 2:]
X_test_A, X_test_B = X_test[:, :5], X_test[:, 2:]
X_new_A, X_new_B = X_test_A[:3], x_test_b[:3] # suppose an unknown sample
# Providing a tuple of training and validation data
history = model.fit((X_train_A, X_train_B), y_train,
epochs=20,
validation_data=((X_valid_A, X_valid_B), y_valid))
# Evaluation and prediction's inputs are also splits
mse_test = model.evaluate((X_test_A, X_test_B), y_test)
y_pred = model.predict((X_new_A, X_new_B))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment