extract_hyperparameters function

Internal function to extract hyperparameters from models.