I train binary LR in python (opencv 3.1 and 4.1) and get always prediction = 1. When I try it on sklearn it works. OpenCV DT and ANN work too.
I tried to train LR with different parametres. Actual version:
dtype = np.float32
train_data = cv.ml.TrainData_create(train_features, cv.ml.ROW_SAMPLE, train_labels.astype(dtype))
cv_model = cv.ml.LogisticRegression_create()
cv_model.setLearningRate(5e-5)
cv_model.setRegularization(cv.ml.LogisticRegression_REG_L2)
cv_model.setTrainMethod(cv.ml.LogisticRegression_MINI_BATCH)
cv_model.setMiniBatchSize(128)
cv_model.setTermCriteria((cv.TERM_CRITERIA_COUNT, int(1e+7), 1e-7))
cv_model.train(train_data)