I have some experience with building classification models in R but it's my first time with Python's sklearn.
So the the problem is: when fitting logistic regression model in R, I have immediate access to predicted class probabilities (model$fitted.values), so I can set my threshold (different than 0.5) in order to maximize some measure.
But in sklearn after fitting I can't find a way to access probabilities. Is it possible? There is a method predict_proba(), but...as the name suggests, it is prediction. So in order to get probabilities, should I 'artificially' do the following procedure?
model = sklearn.linear_model.LogisticRegression() model.fit(train_X, train_y) probs = model.predict_proba(train_X)
Does it make any sense? Or is there some different method to obtain it?