0

I'm trying to change the cut-off point into a logistic regression with the Scikit learn library but I don't see the way even having read the documentation for it. In SPSS it gives you the option to change that parameter but here I don't get it. I put algorithm code. Any help? Thank you

X = np.array(dataS)
y = np.array(target)
X.shape
from sklearn import linear_model
from sklearn import model_selection
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
from sklearn.metrics import accuracy_score
import matplotlib.pyplot as plt
import seaborn as sb
import warnings 
warnings.filterwarnings("ignore")
model = linear_model.LogisticRegression()
model.fit(X,y)
predictions = model.predict(X)
model.score(X,y)

validation_size = 0.20
seed = 7
X_train, X_validation, Y_train, Y_validation = model_selection.train_test_split(X, y, 
test_size=validation_size, random_state=seed)
name='Logistic Regression'
kfold = model_selection.KFold(n_splits=161, random_state=seed)
cv_results = model_selection.cross_val_score(model, X_train, Y_train, cv=kfold, scoring='accuracy')
msg = "%s: %f (%f)" % (name, cv_results.mean(), cv_results.std())
print(msg)

predictions = model.predict(X_validation)
print(accuracy_score(Y_validation, predictions))

print(confusion_matrix(Y_validation, predictions))
print(classification_report(Y_validation, predictions))
Ce ap
  • 1
  • Hi and welcome to AI SE! I think this is only a programming issue, so suited for Data Science SE or Stack Overflow. See [our on-topic page](https://ai.stackexchange.com/help/on-topic) for more details. I will migrate it to Stack Overflow. If you don't find help there, try asking it later on DS SE. – nbro Apr 17 '20 at 13:05
  • Check this answer: https://stackoverflow.com/questions/53846943/sklearn-logistic-regression-adjust-cutoff-point – Edoardo Guerriero Apr 17 '20 at 13:20
  • Perhaps this might also be useful: https://stackoverflow.com/questions/19984957/scikit-predict-default-threshold – F Trias Apr 17 '20 at 13:36

0 Answers0