# 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={},
test_disabled=False, n_components=0.8)
# Add estimator
estimator_switch = Switch('EstimatorSwitch')
estimator_switch += PipelineElement("RandomForestClassifier", hyperparameters={}, n_estimators=50, criterion='gini', max_depth=None, min_samples_split=2, min_samples_leaf=1)
estimator_switch += PipelineElement("GaussianProcessClassifier", hyperparameters={}, optimizer='fmin_l_bfgs_b', n_restarts_optimizer=0)
estimator_switch += PipelineElement("AdaBoostClassifier", hyperparameters={}, n_estimators=50, learning_rate=1)
estimator_switch += PipelineElement("SVC", hyperparameters={}, C=1, gamma='scale', max_iter=1000000.0, kernel='linear')
hyperpipe += estimator_switch