puerto rico过采样⽋采样的处理⽅法
X_train, X_val, y_train, y_val = train_test_split(train_df[predictors], train_df[target], test_size=0.15, random_state=1234)
got you什么意思
from imblearn.over_sampling import SMOTE
oversampler = SMOTE(ratio='auto', random_state=np.random.randint(100), k_neighbors=5, m_neighbors=10, kind='regular', n_jobs=-1) os_X_train, os_y_train = oversampler.fit_sample(X_train,y_train)
from collections import Counter
print('Resampled datat shape {}'.format(Counter(os_y_train)))
注意,过采样之后就不能直接把Pandas.DataFrame数据传⼊模型,特征名称已改变牛津小学英语2b
model=XGBClassifier(
learning_rate =0.1,
n_estimators=1000,
上海口译网max_depth=5,
min_child_weight=1,
gamma=0,
subsample=0.8,
stockingscolsample_bytree=0.8,
objective='binary:logistic',
nthread=-1,
scale_pos_weight=1,
ed=27
激励一代人
)
model.fit(esp是什么
os_X_train,
os_y_train,裙子英文怎么写
eval_t=[(X_val.values, y_val)],
early_stopping_rounds=3,
verbo=True,
eval_metric='auc'
)
def down_sample(df):
infinitive
"""try harder
⽋采样
"""
df1 = df[df['acc_now_delinq']==1]
df2 = df[df['acc_now_delinq']==0]
df3 = df2.sample(frac=0.1)
at([df1, df3], ignore_index=True)