fit(X_train_cv, y_train) y_pred = cv_classifier.predict(X_val_cv) f1 = f1_score(y_val, y_pred, average='macro') print(f1) Result for StratifiedKFold 0.4788555950567123 0.472245024052253 0.518943626206196 0.493477980111068 0.4513438368860056 Here is code for cross_val_score cv_classifier = ...
model.add(Dense(nb_classes)) model.add(Activation('softmax')) model.compile(loss='binary_crossentropy', optimizer='sgd') from sklearn.metrics import log_loss from numpy import savetxt #roc_auc_score(y, y_score) from sklearn.cross_validation import StratifiedKFold cv=[] cvscore=[] kf=...
X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=0.2, random_state=42) seed = 7 np.random.seed(seed) kfold = StratifiedKFold(n_splits=5, shuffle=True, random_state=seed) NB_EPOCH = 20 # split up the data into K partitions / K-fold cross-validation...
cv = cross_validation.ShuffleSplit(X_train.shape[0], n_iter=10,test_size=0.2, random_state=123) clf = grid_search.GridSearchCV(xgb, param_grid, cv=cv, n_jobs=1, scoring='roc_auc') clf = clf.fit(X_train,y_train) report(t, nitems=10*len(param_grid))...