# Specify how results are going to be saved
# Define hyperpipe
hyperpipe = Hyperpipe('None',
project_folder = './results',
optimizer="random_grid_search",
optimizer_params={'n_configurations': 30},
metrics=['accuracy', 'balanced_accuracy', 'specificity', 'sensitivity'],
best_config_metric="balanced_accuracy",
outer_cv = KFold(n_splits=5,shuffle=True),
inner_cv = KFold(n_splits=3, shuffle=True))
# Add transformer elements
preprocessing_pipe = Preprocessing()
hyperpipe += preprocessing_pipe
preprocessing_pipe += PipelineElement("LabelEncoder")
hyperpipe += PipelineElement("SimpleImputer", hyperparameters={},
test_disabled=False, missing_values=np.nan, strategy='mean', fill_value=0)
hyperpipe += PipelineElement("PCA", hyperparameters={'n_components': FloatRange(0.2, 0.99)},
test_disabled=False)
hyperpipe += PipelineElement("RandomForestClassifier", hyperparameters={'n_estimators': [25, 50, 75], 'min_samples_split': IntegerRange(2, 10), 'min_samples_leaf': IntegerRange(1, 10)}, criterion='gini', max_depth=None)