def get_hyperparameters(trial, model):
    """
    Function to selecter hyperparameter space to optimize over depending on the model

    Parameters
    ----------
    trial : A optuna trial instance
    model : str The chosen model

    Returns
    -------
    model_parameters : a dict with parameters for the model
    fit_parameters : a dict with model agnostic parameters to tune.

    """
    model_parameters = {}
    fit_parameters = {}
    if model == 'RETAIN':
        model_parameters['dim_emb'] = trial.suggest_int('dim_emb', 32, 256, 32)
        model_parameters['dropout_emb'] = trial.suggest_uniform('dropout_emb', 0, 0.3)
        model_parameters['dim_alpha'] = trial.suggest_int('dim_alpha', 32, 256, 32)
        model_parameters['dim_beta'] = trial.suggest_int('dim_beta', 32, 256, 32)
        model_parameters['dropout_context'] = trial.suggest_uniform('dropout_context', 0, 0.3)
        model_parameters['num_layers'] = trial.suggest_int('num_layers', 1, 8, 1)
        fit_parameters['lr'] = 3e-4
        fit_parameters['weight_decay'] = 1e-4
    elif model == 'Transformer':
        embedding_per_head = trial.suggest_int('embedding_per_head', 16, 96, 16)
        model_parameters['num_heads'] = trial.suggest_int('num_heads', 2, 6, 2)
        model_parameters['embedding_dim'] = (model_parameters[
                                                 'num_heads'] * embedding_per_head) - 4  # -4 numerical variables
        model_parameters['num_layers'] = trial.suggest_int('attn_depth', 1, 6, 1)
        model_parameters['num_hidden'] = trial.suggest_int('num_hidden', 256, 2048, 1)
        model_parameters['attention_dropout'] = trial.suggest_discrete_uniform('attention_dropout', 0, 0.3, 0.05)
        model_parameters['residual_dropout'] = trial.suggest_discrete_uniform('residual_dropout', 0, 0.3, 0.05)
        model_parameters['ffn_dropout'] = trial.suggest_discrete_uniform('ffn_dropout', 0, 0.3, 0.05)
        model_parameters['max_len'] = 365
        model_parameters['parallel_pools'] = 10
    elif model == 'SARD':
        fit_parameters['finetune_learning_rate'] = 1.5e-4
        fit_parameters['distill_learning_rate'] = 3e-4
        model_parameters['alpha'] = trial.suggest_discrete_uniform('alpha', 0, 0.3, 0.05)
        model_parameters['num_heads'] = 4
        model_parameters['embedding_dim'] = 124
        model_parameters['num_layers'] = 4
        model_parameters['num_hidden'] = 1505
        model_parameters['attention_dropout'] = 0.2
        model_parameters['residual_dropout'] = 0.2
        model_parameters['ffn_dropout'] = 0.1
        model_parameters['max_len'] = 365
        model_parameters['parallel_pools'] = 10
    elif model == 'GNN':
        model_parameters['none_graph_features'] = 4
        model_parameters['num_layers'] = trial.suggest_int('num_layers', 1, 6, 1)
        model_parameters['num_heads'] = trial.suggest_int('num_heads', 1, 4, 1)
        model_parameters['dim_embedding'] = trial.suggest_int('dim_embedding', 32, 1024, 1)
        model_parameters['dropout'] = trial.suggest_uniform('dropout', 0, 0.3)
        model_parameters['attention_dropout'] = trial.suggest_uniform('attention_dropout', 0, 0.3)
    fit_parameters['lr'] = 5e-5
    fit_parameters['weight_decay'] = 1e-4

    return model_parameters, fit_parameters