(X,
                  y,
                  max_trials=3)
return tuner.get_best_models(1)[0], hyp, history
Perform Hyperband Tuning to search for the best model and Hyperparameters
    Arguments:
        X: Input dataset
        y: Label or output dataset
        max_trials: Trials required to perform tuning
Perform Hyperband Tuning to search for the best model and Hyperparameters
    Arguments:
        X: Input dataset
        y: Label or output dataset
        max_trials: Trials required to perform tuning
Perform Hyperband Tuning to search for the best model and Hyperparameters Arguments : X : Input dataset y : Label or output dataset max_trials : Trials required to perform tuning
def tuneHyperband(X,
                  y,
                  max_trials=3):
    """
    Perform Hyperband Tuning to search for the best model and Hyperparameters
    Arguments:
        X: Input dataset
        y: Label or output dataset
        max_trials: Trials required to perform tuning
    """
    hypermodel = HyperResNet(input_shape=(128, 128, 3), num_classes=10)
    tuner = Hyperband(
        hypermodel,
        max_epochs=max_trials,
        objective='val_accuracy',
        seed=42,
    )

    X_train, X_test, y_train, y_test = train_test_split(
        X, y, test_size=0.2, random_state=49)

    # searches the tuner space defined by hyperparameters (hp) and returns the
    # best model
    tuner.search(X_train, y_train,
                 epochs=5,
                 validation_data=(X_test, y_test))
    hyp = tuner.get_best_hyperparameters(num_trials=1)[0]
    #hyp = tuner.oracle.get_best_trials(num_trials=1)[0].hyperparameters.values
    #best_hps = np.stack(hyp).astype(None)

    history = tuner_hist(X, y, tuner, hyp)
    """
    Return:
        models[0] : best model obtained after tuning
        best_hps : best Hyperprameters obtained after tuning, stored as array
        history : history of the data executed from the given model
    """
    return tuner.get_best_models(1)[0], hyp, history
def tuneHyperband ( X , y , max_trials = 3 ) : hypermodel = HyperResNet ( input_shape = ( 128 , 128 , 3 ) , num_classes = 10 ) tuner = Hyperband ( hypermodel , max_epochs = max_trials , objective = 'val_accuracy' , seed = 42 , ) X_train , X_test , y_train , y_test = train_test_split ( X , y , test_size = 0.2 , random_state = 49 ) # searches the tuner space defined by hyperparameters (hp) and returns the # best model tuner . search ( X_train , y_train , epochs = 5 , validation_data = ( X_test , y_test ) ) hyp = tuner . get_best_hyperparameters ( num_trials = 1 ) [ 0 ] #hyp = tuner.oracle.get_best_trials(num_trials=1)[0].hyperparameters.values #best_hps = np.stack(hyp).astype(None) history = tuner_hist ( X , y , tuner , hyp ) """
    Return:
        models[0] : best model obtained after tuning
        best_hps : best Hyperprameters obtained after tuning, stored as array
        history : history of the data executed from the given model
    """ return tuner . get_best_models ( 1 ) [ 0 ] , hyp , history