Xgboost\sklearn.py:768: RuntimeWarning:

Hi, running my calls to Python scikit-learn API xgb.XGBClassifier.predict/predict_proba sometimes seem to yield

C:\workspace\WPy64-3710\python-3.7.1.amd64\lib\site-packages\xgboost\sklearn.py:768: RuntimeWarning: invalid value encountered in greater column_indexes[class_probs > 0.5] = 1

This might be related to using objective ‘rank:pairwise’.

Why is the warning not always shown although the call and data should be the same (random_state=0)? How to fix?

Please use XGBRanker class, since XGBClassifier is not meant for learning to rank