0
0 комментариев

for tr_idx, val_idx in kf.split(X_train_new, y_train_new):

clf = xgb.XGBClassifier(
n_estimators=500,
max_depth=9,
learning_rate=0.15,
subsample=0.9,
colsample_bytree=0.9,
tree_method=’auto’
)

clf1 = lgb.LGBMClassifier(n_estimators=600,
learning_rate=0.1,max_depth=9,
boosting_type=’gbdt’,
objective= ‘binary’,
metric=’auc’,
seed= 4,
num_leaves= 7,
n_jobs=-1)

clf2 = GaussianNB()

models = [clf, clf1, clf2]

X_train_new, X_test_new = stacking(models,
X_train_new, y_train_new,X_test_ch,
regression=False,
mode=’oof_pred_bag’,
needs_proba=False,
save_dir=None,
metric=roc_auc_score,
n_folds=3,
stratified=True,
shuffle=True,
random_state=0,
verbose=2
)

model = LogisticRegression()

X_tr, X_vl = X_train_new.iloc[tr_idx, :], X_train_new.iloc[val_idx, :]
y_tr, y_vl = y_train_new.iloc[tr_idx], y_train_new.iloc[val_idx]

model.fit(X_train_new, y_train_new)

y_pred_train = model.predict_proba(X_vl)[:,1]
y_oof[val_idx] = y_pred_train
print(‘ROC AUC {}’.format(roc_auc_score(y_vl, y_pred_train)))

AttributeError: ‘numpy.ndarray’ object has no attribute ‘iloc’

Asked question
Добавить комментарий