【发布时间】:2018-11-22 16:53:13
【问题描述】:
我正在研究一个分类问题,其评估指标为 ROC AUC。到目前为止,我已经尝试使用具有不同参数的 xgb。这是我用来采样数据的函数。并且可以找到相关的notebookhere (google colab)
def get_data(x_train, y_train, shuffle=False):
if shuffle:
total_train = pd.concat([x_train, y_train], axis=1)
# generate n random number in range(0, len(data))
n = np.random.randint(0, len(total_train), size=len(total_train))
x_train = total_train.iloc[n]
y_train = total_train.iloc[n]['is_pass']
x_train.drop('is_pass', axis=1, inplace=True)
# keep the first 1000 rows as test data
x_test = x_train.iloc[:1000]
# keep the 1000 to 10000 rows as validation data
x_valid = x_train.iloc[1000:10000]
x_train = x_train.iloc[10000:]
y_test = y_train[:1000]
y_valid = y_train[1000:10000]
y_train = y_train.iloc[10000:]
return x_train, x_valid, x_test, y_train, y_valid, y_test
else:
# keep the first 1000 rows as test data
x_test = x_train.iloc[:1000]
# keep the 1000 to 10000 rows as validation data
x_valid = x_train.iloc[1000:10000]
x_train = x_train.iloc[10000:]
y_test = y_train[:1000]
y_valid = y_train[1000:10000]
y_train = y_train.iloc[10000:]
return x_train, x_valid, x_test, y_train, y_valid, y_test
这是我在混洗和非混洗数据上运行后得到的两个输出
AUC with shuffling: 0.9021756235738453
AUC without shuffling: 0.8025162142685565
你能找出这里的问题吗?
【问题讨论】:
-
可能是欠拟合?因此准确性取决于随机因素(例如训练程序中的评估顺序)而不是预测参数。