compteur = 0 proba = pm.Bernoulli('p',0.5) best_val = 0 kf = KFold(len(X_trainDF),5,shuffle=True,random_state=55) while compteur < Iteration: print compteur C = 10**(uniform(-6,-2)) p = uniform(3,6) npca = randrange(5, 30) which_feature = {k:int(proba.random()) for k in Feature.transformer_weights.keys()} which_feature['HOGFeature'] = 1 which_feature['SobelFeature'] = 1 Feature.transformer_weights = which_feature param = {'SobelFeature__PCA__n_components':npca, 'RawImage__PCA__n_components':npca, 'HOGFeature__PCA__n_components':npca} Feature.set_params(**param) scores = []; rocauctr = []; rocaucval = [] print 'Debut cross-validation' for train_index, val_index in kf: X_trDF, X_valDF = X_trainDF.iloc[train_index], X_trainDF.iloc[val_index] y_trDF, y_valDF = y_trainDF.iloc[train_index], y_trainDF.iloc[val_index] X_tr = Feature.fit_transform(X_trDF) y_tr = np.array(y_trDF)[:,np.newaxis] X_val = Feature.transform(X_valDF)