How can I tell how confidence the model is with respect to the end result? For example, say I have a logistic regression model to identify an iris (Setosa, Versicolor, Virginica).
I trained the model and at the end for a given input I get a classification of Setosa. How can I tell the probability of the model that this is a Setosa? (example, 89% setosa, 5% Verginica and 6% versicolor)
model = LogisticRegression()
model.fit(x_train, y_train)
Later I have:
predictions = model.predict(my_one_test)
predictions
but the results is the category:
array(['setosa'], dtype=object)
Assuming you are using the scikit-learn library and its LogisticRegression implementation, you can use predict_proba(X)
to get the probability estimates (docs).
You can change your snippet to the following
predictions = model.predict_proba(my_one_test)