f1-оценка всегда ~ 0,75? - PullRequest
       34

f1-оценка всегда ~ 0,75?

0 голосов
/ 03 июля 2019

Я работаю над (как мне кажется,) прямой проблемой двоичной классификации.Я получаю этот любопытный результат от моего поиска по сетке параметров, что независимо от того, какие параметры у модели, она всегда возвращает f1-оценку ~ 0,75.Я не уверен, что это: а) отражает то, что я неправильно понимаю в отношении показателя f1 как метрики; б) связано с некоторой проблемой с данными или моделью (я использую XGBoost), которую необходимо исправить, илив) просто показывает, что параметры модели в основном не имеют значения, и показатель f1 ~ 0,75 настолько хорош, насколько я получу.

Еще более запутанно, я получил этот же результат для двух совершенно разных наборов предикторов длята же самая проблема (например, если я предсказывал стоимость недвижимости, один набор использовал цены соседства, а другой набор использовал характеристики дома - различные наборы предикторов для той же самой проблемы).Для одного набора диапазон составлял примерно 0,67–0,82 с приблизительно нормальной дисперсией, а для второго набора (показанного ниже) каждый набор параметров давал практически одинаковую оценку f1, равную 0,7477.

Чтобы дать более подробную информациютекущий набор данных содержит около 30 000 примеров, один класс составляет около 60% примеров (другой - 40%).Я еще не углубился в этот новый набор данных, но с предыдущим набором данных, когда я исследовал одну модель более тщательно, я нашел разумную точность и значения отзыва, которые несколько изменились с различными наборами параметров, что разрушило мое беспокойство, что модель былапросто угадываю более распространенный класс.

Я использую XGBoost, и использую scikit-learn's GridSearchCV.Пропуск импорта и т. Д. Код поиска по сетке:

grid_values = {'n_estimators':[50,100,200,500,1000],'max_depth':[1,3,5,8], 'min_child_weight':range(1,6,2)}

clf=XGBClassifier()

grid_clf=GridSearchCV(clf,param_grid=grid_values,scoring='f1',verbose=10)
grid_clf.fit(game_records,hora)

print('Grid best score (f1): ', grid_clf.best_score_)
print('Grid best parameter (max. f1): ', grid_clf.best_params_)

Полный вывод на https://pastebin.com/NSB0yaNi, с показанной здесь частью (большей частью):

Fitting 3 folds for each of 60 candidates, totalling 180 fits
[CV] max_depth=1, min_child_weight=1, n_estimators=50 ................
[CV]  max_depth=1, min_child_weight=1, n_estimators=50, score=0.7477603583426652, total=  11.1s
[CV] max_depth=1, min_child_weight=1, n_estimators=50 ................
[Parallel(n_jobs=1)]: Done   1 out of   1 | elapsed:   11.4s remaining:    0.0s
[CV]  max_depth=1, min_child_weight=1, n_estimators=50, score=0.74772504549909, total=  11.3s
[CV] max_depth=1, min_child_weight=1, n_estimators=50 ................
[Parallel(n_jobs=1)]: Done   2 out of   2 | elapsed:   23.1s remaining:    0.0s
[CV]  max_depth=1, min_child_weight=1, n_estimators=50, score=0.7477773888694436, total=  11.2s
[CV] max_depth=1, min_child_weight=1, n_estimators=100 ...............
[Parallel(n_jobs=1)]: Done   3 out of   3 | elapsed:   34.8s remaining:    0.0s
[CV]  max_depth=1, min_child_weight=1, n_estimators=100, score=0.7477603583426652, total=  21.4s
[CV] max_depth=1, min_child_weight=1, n_estimators=100 ...............
[Parallel(n_jobs=1)]: Done   4 out of   4 | elapsed:   56.8s remaining:    0.0s
[CV]  max_depth=1, min_child_weight=1, n_estimators=100, score=0.74772504549909, total=  21.3s
[CV] max_depth=1, min_child_weight=1, n_estimators=100 ...............
[Parallel(n_jobs=1)]: Done   5 out of   5 | elapsed:  1.3min remaining:    0.0s
[CV]  max_depth=1, min_child_weight=1, n_estimators=100, score=0.7477773888694436, total=  21.0s
[CV] max_depth=1, min_child_weight=1, n_estimators=200 ...............
[Parallel(n_jobs=1)]: Done   6 out of   6 | elapsed:  1.7min remaining:    0.0s
[CV]  max_depth=1, min_child_weight=1, n_estimators=200, score=0.7477603583426652, total=  41.3s
[CV] max_depth=1, min_child_weight=1, n_estimators=200 ...............
[Parallel(n_jobs=1)]: Done   7 out of   7 | elapsed:  2.4min remaining:    0.0s
[CV]  max_depth=1, min_child_weight=1, n_estimators=200, score=0.74772504549909, total=  41.1s
[CV] max_depth=1, min_child_weight=1, n_estimators=200 ...............
[Parallel(n_jobs=1)]: Done   8 out of   8 | elapsed:  3.1min remaining:    0.0s
[CV]  max_depth=1, min_child_weight=1, n_estimators=200, score=0.7477773888694436, total=  41.1s
[CV] max_depth=1, min_child_weight=1, n_estimators=500 ...............
[Parallel(n_jobs=1)]: Done   9 out of   9 | elapsed:  3.7min remaining:    0.0s
[CV]  max_depth=1, min_child_weight=1, n_estimators=500, score=0.7477603583426652, total= 1.7min
[CV] max_depth=1, min_child_weight=1, n_estimators=500 ...............
[CV]  max_depth=1, min_child_weight=1, n_estimators=500, score=0.74772504549909, total= 1.8min
[CV] max_depth=1, min_child_weight=1, n_estimators=500 ...............
[CV]  max_depth=1, min_child_weight=1, n_estimators=500, score=0.7477773888694436, total= 1.7min
[CV] max_depth=1, min_child_weight=1, n_estimators=1000 ..............
[CV]  max_depth=1, min_child_weight=1, n_estimators=1000, score=0.7477603583426652, total= 3.4min
[CV] max_depth=1, min_child_weight=1, n_estimators=1000 ..............
[CV]  max_depth=1, min_child_weight=1, n_estimators=1000, score=0.74772504549909, total= 3.4min

...

[CV] max_depth=3, min_child_weight=1, n_estimators=50 ................
[CV]  max_depth=3, min_child_weight=1, n_estimators=50, score=0.7477773888694436, total=  10.9s
[CV] max_depth=3, min_child_weight=1, n_estimators=100 ...............
[CV]  max_depth=3, min_child_weight=1, n_estimators=100, score=0.7477603583426652, total=  21.2s
[CV] max_depth=3, min_child_weight=1, n_estimators=100 ...............
[CV]  max_depth=3, min_child_weight=1, n_estimators=100, score=0.74772504549909, total=  21.0s
[CV] max_depth=3, min_child_weight=1, n_estimators=100 ...............
[CV]  max_depth=3, min_child_weight=1, n_estimators=100, score=0.7477773888694436, total=  20.9s
[CV] max_depth=3, min_child_weight=1, n_estimators=200 ...............
[CV]  max_depth=3, min_child_weight=1, n_estimators=200, score=0.7477603583426652, total=  41.0s
[CV] max_depth=3, min_child_weight=1, n_estimators=200 ...............
[CV]  max_depth=3, min_child_weight=1, n_estimators=200, score=0.74772504549909, total=  41.2s
[CV] max_depth=3, min_child_weight=1, n_estimators=200 ...............
[CV]  max_depth=3, min_child_weight=1, n_estimators=200, score=0.7477773888694436, total=  41.4s
[CV] max_depth=3, min_child_weight=1, n_estimators=500 ...............
[CV]  max_depth=3, min_child_weight=1, n_estimators=500, score=0.7477603583426652, total= 1.7min
[CV] max_depth=3, min_child_weight=1, n_estimators=500 ...............
[CV]  max_depth=3, min_child_weight=1, n_estimators=500, score=0.74772504549909, total= 1.7min
[CV] max_depth=3, min_child_weight=1, n_estimators=500 ...............
[CV]  max_depth=3, min_child_weight=1, n_estimators=500, score=0.7477773888694436, total= 1.7min
[CV] max_depth=3, min_child_weight=1, n_estimators=1000 ..............
[CV]  max_depth=3, min_child_weight=1, n_estimators=1000, score=0.7477603583426652, total= 3.4min
[CV] max_depth=3, min_child_weight=1, n_estimators=1000 ..............
[CV]  max_depth=3, min_child_weight=1, n_estimators=1000, score=0.74772504549909, total= 3.4min
[CV] max_depth=3, min_child_weight=1, n_estimators=1000 ..............
[CV]  max_depth=3, min_child_weight=1, n_estimators=1000, score=0.7477773888694436, total= 3.4min
[CV] max_depth=3, min_child_weight=3, n_estimators=50 ................
[CV]  max_depth=3, min_child_weight=3, n_estimators=50, score=0.7477603583426652, total=  10.9s
[CV] max_depth=3, min_child_weight=3, n_estimators=50 ................
[CV]  max_depth=3, min_child_weight=3, n_estimators=50, score=0.74772504549909, total=  11.0s
[CV] max_depth=3, min_child_weight=3, n_estimators=50 ................
[CV]  max_depth=3, min_child_weight=3, n_estimators=50, score=0.7477773888694436, total=  10.9s
[CV] max_depth=3, min_child_weight=3, n_estimators=100 ...............
[CV]  max_depth=3, min_child_weight=3, n_estimators=100, score=0.7477603583426652, total=  20.9s
[CV] max_depth=3, min_child_weight=3, n_estimators=100 ...............
[CV]  max_depth=3, min_child_weight=3, n_estimators=100, score=0.74772504549909, total=  21.0s
[CV] max_depth=3, min_child_weight=3, n_estimators=100 ...............
[CV]  max_depth=3, min_child_weight=3, n_estimators=100, score=0.7477773888694436, total=  21.0s
[CV] max_depth=3, min_child_weight=3, n_estimators=200 ...............
[CV]  max_depth=3, min_child_weight=3, n_estimators=200, score=0.7477603583426652, total=  41.2s
[CV] max_depth=3, min_child_weight=3, n_estimators=200 ...............
[CV]  max_depth=3, min_child_weight=3, n_estimators=200, score=0.74772504549909, total=  41.2s
[CV] max_depth=3, min_child_weight=3, n_estimators=200 ...............
[CV]  max_depth=3, min_child_weight=3, n_estimators=200, score=0.7477773888694436, total=  41.2s
[CV] max_depth=3, min_child_weight=3, n_estimators=500 ...............
[CV]  max_depth=3, min_child_weight=3, n_estimators=500, score=0.7477603583426652, total= 1.7min
[CV] max_depth=3, min_child_weight=3, n_estimators=500 ...............
[CV]  max_depth=3, min_child_weight=3, n_estimators=500, score=0.74772504549909, total= 1.7min
[CV] max_depth=3, min_child_weight=3, n_estimators=500 ...............
[CV]  max_depth=3, min_child_weight=3, n_estimators=500, score=0.7477773888694436, total= 1.7min
[CV] max_depth=3, min_child_weight=3, n_estimators=1000 ..............
[CV]  max_depth=3, min_child_weight=3, n_estimators=1000, score=0.7477603583426652, total= 3.4min
[CV] max_depth=3, min_child_weight=3, n_estimators=1000 ..............
[CV]  max_depth=3, min_child_weight=3, n_estimators=1000, score=0.74772504549909, total= 3.4min
[CV] max_depth=3, min_child_weight=3, n_estimators=1000 ..............
[CV]  max_depth=3, min_child_weight=3, n_estimators=1000, score=0.7477773888694436, total= 3.4min
[CV] max_depth=3, min_child_weight=5, n_estimators=50 ................
[CV]  max_depth=3, min_child_weight=5, n_estimators=50, score=0.7477603583426652, total=  11.0s
[CV] max_depth=3, min_child_weight=5, n_estimators=50 ................
[CV]  max_depth=3, min_child_weight=5, n_estimators=50, score=0.74772504549909, total=  10.9s
[CV] max_depth=3, min_child_weight=5, n_estimators=50 ................
[CV]  max_depth=3, min_child_weight=5, n_estimators=50, score=0.7477773888694436, total=  10.9s
[CV] max_depth=3, min_child_weight=5, n_estimators=100 ...............
[CV]  max_depth=3, min_child_weight=5, n_estimators=100, score=0.7477603583426652, total=  21.2s
[CV] max_depth=3, min_child_weight=5, n_estimators=100 ...............
[CV]  max_depth=3, min_child_weight=5, n_estimators=100, score=0.74772504549909, total=  21.0s
[CV] max_depth=3, min_child_weight=5, n_estimators=100 ...............
[CV]  max_depth=3, min_child_weight=5, n_estimators=100, score=0.7477773888694436, total=  21.0s
[CV] max_depth=3, min_child_weight=5, n_estimators=200 ...............
[CV]  max_depth=3, min_child_weight=5, n_estimators=200, score=0.7477603583426652, total=  41.1s
[CV] max_depth=3, min_child_weight=5, n_estimators=200 ...............
[CV]  max_depth=3, min_child_weight=5, n_estimators=200, score=0.74772504549909, total=  41.3s
[CV] max_depth=3, min_child_weight=5, n_estimators=200 ...............
[CV]  max_depth=3, min_child_weight=5, n_estimators=200, score=0.7477773888694436, total=  41.0s
[CV] max_depth=3, min_child_weight=5, n_estimators=500 ...............
[CV]  max_depth=3, min_child_weight=5, n_estimators=500, score=0.7477603583426652, total= 1.7min
[CV] max_depth=3, min_child_weight=5, n_estimators=500 ...............
[CV]  max_depth=3, min_child_weight=5, n_estimators=500, score=0.74772504549909, total= 1.7min
[CV] max_depth=3, min_child_weight=5, n_estimators=500 ...............
[CV]  max_depth=3, min_child_weight=5, n_estimators=500, score=0.7477773888694436, total= 1.7min
[CV] max_depth=3, min_child_weight=5, n_estimators=1000 ..............
[CV]  max_depth=3, min_child_weight=5, n_estimators=1000, score=0.7477603583426652, total= 3.4min
[CV] max_depth=3, min_child_weight=5, n_estimators=1000 ..............
[CV]  max_depth=3, min_child_weight=5, n_estimators=1000, score=0.74772504549909, total= 3.4min
[CV] max_depth=3, min_child_weight=5, n_estimators=1000 ..............
[CV]  max_depth=3, min_child_weight=5, n_estimators=1000, score=0.7477773888694436, total= 3.4min
[CV] max_depth=5, min_child_weight=1, n_estimators=50 ................
[CV]  max_depth=5, min_child_weight=1, n_estimators=50, score=0.7477603583426652, total=  10.9s
[CV] max_depth=5, min_child_weight=1, n_estimators=50 ................
[CV]  max_depth=5, min_child_weight=1, n_estimators=50, score=0.74772504549909, total=  10.9s
[CV] max_depth=5, min_child_weight=1, n_estimators=50 ................
[CV]  max_depth=5, min_child_weight=1, n_estimators=50, score=0.7477773888694436, total=  10.9s
[CV] max_depth=5, min_child_weight=1, n_estimators=100 ...............
[CV]  max_depth=5, min_child_weight=1, n_estimators=100, score=0.7477603583426652, total=  21.0s
[CV] max_depth=5, min_child_weight=1, n_estimators=100 ...............
[CV]  max_depth=5, min_child_weight=1, n_estimators=100, score=0.74772504549909, total=  21.1s
[CV] max_depth=5, min_child_weight=1, n_estimators=100 ...............
[CV]  max_depth=5, min_child_weight=1, n_estimators=100, score=0.7477773888694436, total=  21.0s
[CV] max_depth=5, min_child_weight=1, n_estimators=200 ...............
[CV]  max_depth=5, min_child_weight=1, n_estimators=200, score=0.7477603583426652, total=  41.3s
[CV] max_depth=5, min_child_weight=1, n_estimators=200 ...............
[CV]  max_depth=5, min_child_weight=1, n_estimators=200, score=0.74772504549909, total=  41.1s
[CV] max_depth=5, min_child_weight=1, n_estimators=200 ...............
[CV]  max_depth=5, min_child_weight=1, n_estimators=200, score=0.7477773888694436, total=  41.1s
[CV] max_depth=5, min_child_weight=1, n_estimators=500 ...............
[CV]  max_depth=5, min_child_weight=1, n_estimators=500, score=0.7477603583426652, total= 1.7min
[CV] max_depth=5, min_child_weight=1, n_estimators=500 ...............
[CV]  max_depth=5, min_child_weight=1, n_estimators=500, score=0.74772504549909, total= 1.7min
[CV] max_depth=5, min_child_weight=1, n_estimators=500 ...............
[CV]  max_depth=5, min_child_weight=1, n_estimators=500, score=0.7477773888694436, total= 1.7min
[CV] max_depth=5, min_child_weight=1, n_estimators=1000 ..............
[CV]  max_depth=5, min_child_weight=1, n_estimators=1000, score=0.7477603583426652, total= 3.4min
[CV] max_depth=5, min_child_weight=1, n_estimators=1000 ..............
[CV]  max_depth=5, min_child_weight=1, n_estimators=1000, score=0.74772504549909, total= 3.4min
[CV] max_depth=5, min_child_weight=1, n_estimators=1000 ..............
[CV]  max_depth=5, min_child_weight=1, n_estimators=1000, score=0.7477773888694436, total= 3.4min
[CV] max_depth=5, min_child_weight=3, n_estimators=50 ................
[CV]  max_depth=5, min_child_weight=3, n_estimators=50, score=0.7477603583426652, total=  10.9s
[CV] max_depth=5, min_child_weight=3, n_estimators=50 ................
[CV]  max_depth=5, min_child_weight=3, n_estimators=50, score=0.74772504549909, total=  10.9s
[CV] max_depth=5, min_child_weight=3, n_estimators=50 ................
[CV]  max_depth=5, min_child_weight=3, n_estimators=50, score=0.7477773888694436, total=  11.0s
[CV] max_depth=5, min_child_weight=3, n_estimators=100 ...............
[CV]  max_depth=5, min_child_weight=3, n_estimators=100, score=0.7477603583426652, total=  21.3s
[CV] max_depth=5, min_child_weight=3, n_estimators=100 ...............
[CV]  max_depth=5, min_child_weight=3, n_estimators=100, score=0.74772504549909, total=  20.9s
[CV] max_depth=5, min_child_weight=3, n_estimators=100 ...............
[CV]  max_depth=5, min_child_weight=3, n_estimators=100, score=0.7477773888694436, total=  20.9s
[CV] max_depth=5, min_child_weight=3, n_estimators=200 ...............
[CV]  max_depth=5, min_child_weight=3, n_estimators=200, score=0.7477603583426652, total=  41.1s
[CV] max_depth=5, min_child_weight=3, n_estimators=200 ...............
[CV]  max_depth=5, min_child_weight=3, n_estimators=200, score=0.74772504549909, total=  41.4s
[CV] max_depth=5, min_child_weight=3, n_estimators=200 ...............
[CV]  max_depth=5, min_child_weight=3, n_estimators=200, score=0.7477773888694436, total=  41.1s
[CV] max_depth=5, min_child_weight=3, n_estimators=500 ...............
[CV]  max_depth=5, min_child_weight=3, n_estimators=500, score=0.7477603583426652, total= 1.7min
[CV] max_depth=5, min_child_weight=3, n_estimators=500 ...............
[CV]  max_depth=5, min_child_weight=3, n_estimators=500, score=0.74772504549909, total= 1.7min
[CV] max_depth=5, min_child_weight=3, n_estimators=500 ...............
[CV]  max_depth=5, min_child_weight=3, n_estimators=500, score=0.7477773888694436, total= 1.7min
[CV] max_depth=5, min_child_weight=3, n_estimators=1000 ..............
[CV]  max_depth=5, min_child_weight=3, n_estimators=1000, score=0.7477603583426652, total= 3.4min
[CV] max_depth=5, min_child_weight=3, n_estimators=1000 ..............
[CV]  max_depth=5, min_child_weight=3, n_estimators=1000, score=0.74772504549909, total= 3.4min
[CV] max_depth=5, min_child_weight=3, n_estimators=1000 ..............
[CV]  max_depth=5, min_child_weight=3, n_estimators=1000, score=0.7477773888694436, total= 3.4min
[CV] max_depth=5, min_child_weight=5, n_estimators=50 ................
[CV]  max_depth=5, min_child_weight=5, n_estimators=50, score=0.7477603583426652, total=  11.0s
[CV] max_depth=5, min_child_weight=5, n_estimators=50 ................
[CV]  max_depth=5, min_child_weight=5, n_estimators=50, score=0.74772504549909, total=  11.0s
[CV] max_depth=5, min_child_weight=5, n_estimators=50 ................
[CV]  max_depth=5, min_child_weight=5, n_estimators=50, score=0.7477773888694436, total=  10.9s
[CV] max_depth=5, min_child_weight=5, n_estimators=100 ...............
[CV]  max_depth=5, min_child_weight=5, n_estimators=100, score=0.7477603583426652, total=  21.0s
[CV] max_depth=5, min_child_weight=5, n_estimators=100 ...............
[CV]  max_depth=5, min_child_weight=5, n_estimators=100, score=0.74772504549909, total=  21.0s
[CV] max_depth=5, min_child_weight=5, n_estimators=100 ...............
[CV]  max_depth=5, min_child_weight=5, n_estimators=100, score=0.7477773888694436, total=  21.8s
[CV] max_depth=5, min_child_weight=5, n_estimators=200 ...............
[CV]  max_depth=5, min_child_weight=5, n_estimators=200, score=0.7477603583426652, total=  41.2s
[CV] max_depth=5, min_child_weight=5, n_estimators=200 ...............
[CV]  max_depth=5, min_child_weight=5, n_estimators=200, score=0.74772504549909, total=  41.6s
[CV] max_depth=5, min_child_weight=5, n_estimators=200 ...............
[CV]  max_depth=5, min_child_weight=5, n_estimators=200, score=0.7477773888694436, total=  41.2s
[CV] max_depth=5, min_child_weight=5, n_estimators=500 ...............
[CV]  max_depth=5, min_child_weight=5, n_estimators=500, score=0.7477603583426652, total= 1.7min
[CV] max_depth=5, min_child_weight=5, n_estimators=500 ...............
[CV]  max_depth=5, min_child_weight=5, n_estimators=500, score=0.74772504549909, total= 1.7min
[CV] max_depth=5, min_child_weight=5, n_estimators=500 ...............
[CV]  max_depth=5, min_child_weight=5, n_estimators=500, score=0.7477773888694436, total= 1.7min
[CV] max_depth=5, min_child_weight=5, n_estimators=1000 ..............
[CV]  max_depth=5, min_child_weight=5, n_estimators=1000, score=0.7477603583426652, total= 3.4min
[CV] max_depth=5, min_child_weight=5, n_estimators=1000 ..............
[CV]  max_depth=5, min_child_weight=5, n_estimators=1000, score=0.74772504549909, total= 3.4min
[CV] max_depth=5, min_child_weight=5, n_estimators=1000 ..............
[CV]  max_depth=5, min_child_weight=5, n_estimators=1000, score=0.7477773888694436, total= 3.4min
[CV] max_depth=8, min_child_weight=1, n_estimators=50 ................
[CV]  max_depth=8, min_child_weight=1, n_estimators=50, score=0.7477603583426652, total=  10.9s
[CV] max_depth=8, min_child_weight=1, n_estimators=50 ................
[CV]  max_depth=8, min_child_weight=1, n_estimators=50, score=0.74772504549909, total=  10.9s
[CV] max_depth=8, min_child_weight=1, n_estimators=50 ................
[CV]  max_depth=8, min_child_weight=1, n_estimators=50, score=0.7477773888694436, total=  10.9s
[CV] max_depth=8, min_child_weight=1, n_estimators=100 ...............
[CV]  max_depth=8, min_child_weight=1, n_estimators=100, score=0.7477603583426652, total=  21.2s
[CV] max_depth=8, min_child_weight=1, n_estimators=100 ...............
[CV]  max_depth=8, min_child_weight=1, n_estimators=100, score=0.74772504549909, total=  21.0s
[CV] max_depth=8, min_child_weight=1, n_estimators=100 ...............
[CV]  max_depth=8, min_child_weight=1, n_estimators=100, score=0.7477773888694436, total=  20.9s
[CV] max_depth=8, min_child_weight=1, n_estimators=200 ...............
[CV]  max_depth=8, min_child_weight=1, n_estimators=200, score=0.7477603583426652, total=  41.0s
[CV] max_depth=8, min_child_weight=1, n_estimators=200 ...............
[CV]  max_depth=8, min_child_weight=1, n_estimators=200, score=0.74772504549909, total=  41.4s
[CV] max_depth=8, min_child_weight=1, n_estimators=200 ...............
[CV]  max_depth=8, min_child_weight=1, n_estimators=200, score=0.7477773888694436, total=  41.0s
[CV] max_depth=8, min_child_weight=1, n_estimators=500 ...............
[CV]  max_depth=8, min_child_weight=1, n_estimators=500, score=0.7477603583426652, total= 1.7min
[CV] max_depth=8, min_child_weight=1, n_estimators=500 ...............
[CV]  max_depth=8, min_child_weight=1, n_estimators=500, score=0.74772504549909, total= 1.7min
[CV] max_depth=8, min_child_weight=1, n_estimators=500 ...............
[CV]  max_depth=8, min_child_weight=1, n_estimators=500, score=0.7477773888694436, total= 1.7min
[CV] max_depth=8, min_child_weight=1, n_estimators=1000 ..............
[CV]  max_depth=8, min_child_weight=1, n_estimators=1000, score=0.7477603583426652, total= 3.4min
[CV] max_depth=8, min_child_weight=1, n_estimators=1000 ..............
[CV]  max_depth=8, min_child_weight=1, n_estimators=1000, score=0.74772504549909, total= 3.4min
[CV] max_depth=8, min_child_weight=1, n_estimators=1000 ..............
[CV]  max_depth=8, min_child_weight=1, n_estimators=1000, score=0.7477773888694436, total= 3.4min
[CV] max_depth=8, min_child_weight=3, n_estimators=50 ................
[CV]  max_depth=8, min_child_weight=3, n_estimators=50, score=0.7477603583426652, total=  10.9s
[CV] max_depth=8, min_child_weight=3, n_estimators=50 ................
[CV]  max_depth=8, min_child_weight=3, n_estimators=50, score=0.74772504549909, total=  10.9s
[CV] max_depth=8, min_child_weight=3, n_estimators=50 ................
[CV]  max_depth=8, min_child_weight=3, n_estimators=50, score=0.7477773888694436, total=  10.9s
[CV] max_depth=8, min_child_weight=3, n_estimators=100 ...............
[CV]  max_depth=8, min_child_weight=3, n_estimators=100, score=0.7477603583426652, total=  20.9s
[CV] max_depth=8, min_child_weight=3, n_estimators=100 ...............
[CV]  max_depth=8, min_child_weight=3, n_estimators=100, score=0.74772504549909, total=  21.0s
[CV] max_depth=8, min_child_weight=3, n_estimators=100 ...............
[CV]  max_depth=8, min_child_weight=3, n_estimators=100, score=0.7477773888694436, total=  20.9s
[CV] max_depth=8, min_child_weight=3, n_estimators=200 ...............
[CV]  max_depth=8, min_child_weight=3, n_estimators=200, score=0.7477603583426652, total=  41.3s
[CV] max_depth=8, min_child_weight=3, n_estimators=200 ...............
[CV]  max_depth=8, min_child_weight=3, n_estimators=200, score=0.74772504549909, total=  41.1s
[CV] max_depth=8, min_child_weight=3, n_estimators=200 ...............
[CV]  max_depth=8, min_child_weight=3, n_estimators=200, score=0.7477773888694436, total=  41.2s
[CV] max_depth=8, min_child_weight=3, n_estimators=500 ...............
[CV]  max_depth=8, min_child_weight=3, n_estimators=500, score=0.7477603583426652, total= 1.7min
[CV] max_depth=8, min_child_weight=3, n_estimators=500 ...............
[CV]  max_depth=8, min_child_weight=3, n_estimators=500, score=0.74772504549909, total= 1.7min
[CV] max_depth=8, min_child_weight=3, n_estimators=500 ...............
[CV]  max_depth=8, min_child_weight=3, n_estimators=500, score=0.7477773888694436, total= 1.7min
[CV] max_depth=8, min_child_weight=3, n_estimators=1000 ..............
[CV]  max_depth=8, min_child_weight=3, n_estimators=1000, score=0.7477603583426652, total= 3.4min
[CV] max_depth=8, min_child_weight=3, n_estimators=1000 ..............
[CV]  max_depth=8, min_child_weight=3, n_estimators=1000, score=0.74772504549909, total= 3.4min
[CV] max_depth=8, min_child_weight=3, n_estimators=1000 ..............
[CV]  max_depth=8, min_child_weight=3, n_estimators=1000, score=0.7477773888694436, total= 3.4min
[CV] max_depth=8, min_child_weight=5, n_estimators=50 ................
[CV]  max_depth=8, min_child_weight=5, n_estimators=50, score=0.7477603583426652, total=  10.9s
[CV] max_depth=8, min_child_weight=5, n_estimators=50 ................
[CV]  max_depth=8, min_child_weight=5, n_estimators=50, score=0.74772504549909, total=  10.9s
[CV] max_depth=8, min_child_weight=5, n_estimators=50 ................
[CV]  max_depth=8, min_child_weight=5, n_estimators=50, score=0.7477773888694436, total=  10.9s
[CV] max_depth=8, min_child_weight=5, n_estimators=100 ...............
[CV]  max_depth=8, min_child_weight=5, n_estimators=100, score=0.7477603583426652, total=  20.9s
[CV] max_depth=8, min_child_weight=5, n_estimators=100 ...............
[CV]  max_depth=8, min_child_weight=5, n_estimators=100, score=0.74772504549909, total=  21.4s
[CV] max_depth=8, min_child_weight=5, n_estimators=100 ...............
[CV]  max_depth=8, min_child_weight=5, n_estimators=100, score=0.7477773888694436, total=  21.0s
[CV] max_depth=8, min_child_weight=5, n_estimators=200 ...............
[CV]  max_depth=8, min_child_weight=5, n_estimators=200, score=0.7477603583426652, total=  41.2s
[CV] max_depth=8, min_child_weight=5, n_estimators=200 ...............
[CV]  max_depth=8, min_child_weight=5, n_estimators=200, score=0.74772504549909, total=  41.3s
[CV] max_depth=8, min_child_weight=5, n_estimators=200 ...............
[CV]  max_depth=8, min_child_weight=5, n_estimators=200, score=0.7477773888694436, total=  41.0s
[CV] max_depth=8, min_child_weight=5, n_estimators=500 ...............
[CV]  max_depth=8, min_child_weight=5, n_estimators=500, score=0.7477603583426652, total= 1.7min
[CV] max_depth=8, min_child_weight=5, n_estimators=500 ...............
[CV]  max_depth=8, min_child_weight=5, n_estimators=500, score=0.74772504549909, total= 1.7min
[CV] max_depth=8, min_child_weight=5, n_estimators=500 ...............
[CV]  max_depth=8, min_child_weight=5, n_estimators=500, score=0.7477773888694436, total= 1.7min
[CV] max_depth=8, min_child_weight=5, n_estimators=1000 ..............
[CV]  max_depth=8, min_child_weight=5, n_estimators=1000, score=0.7477603583426652, total= 3.4min
[CV] max_depth=8, min_child_weight=5, n_estimators=1000 ..............
[CV]  max_depth=8, min_child_weight=5, n_estimators=1000, score=0.74772504549909, total= 3.4min
[CV] max_depth=8, min_child_weight=5, n_estimators=1000 ..............
[CV]  max_depth=8, min_child_weight=5, n_estimators=1000, score=0.7477773888694436, total= 3.4min
[Parallel(n_jobs=1)]: Done 180 out of 180 | elapsed: 227.8min finished
Grid best score (f1):  0.7477542636024276
Grid best parameter (max. f1):  {'max_depth': 1, 'min_child_weight': 1, 'n_estimators': 50}

1 Ответ

1 голос
/ 03 июля 2019

Давайте предположим, что ваш классификатор предсказывает все как мажоритарный класс, тогда ваш:

precision = tp/(tp+fp) = 60/(60+40) = 0,6
recall = tp/(tp+fn) = 60/(60+0) = 1

и ваш счет f1:

f1 = 2*precision*recall/(precision+recall)= 2*0,6*1/(0,6+1)
   = 1,2/1,6= 0,75

Итак, вероятно, ваш классификатор всегда предсказывает класс большинства.

Чтобы проверить вашу confusion_matrix один раз, вы можете использовать следующее:

from sklearn.metrics import confusion_matrix
print(confusion_matrix(y_true, y_pred))
...