Answer the question
In order to leave comments, you need to log in
How to understand in what order the probability of an event is given?
I set the model with an example.
import numpy as np
X = np.array() #Тут массив из 3
y = np.array([2, 1, 1, 1])
from sklearn.svm import SVC
clf = SVC(probability=True) #Обязательно задать для расчета вероятностей
clf.fit(X, y)
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma='auto', kernel='rbf',
max_iter=-1, probability=True, random_state=None, shrinking=True,
tol=0.001, verbose=False)
print(clf.predict()) # И тут массив из 3
print(clf.predict_proba())
Answer the question
In order to leave comments, you need to log in
After calling the clf.fit method, the clf.classes_ attribute will be filled with information about the class labels, in the same order that they appear in the output of the clf.predict_proba method.
In [4]: svc = SVC()
In [5]: import numpy as np
...: X = np.array() #Тут массив из 3
...: y = np.array([2, 1, 1, 1])
In [6]: svc.fit(X, y)
Out[6]:
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovr', degree=3, gamma='auto', kernel='rbf',
max_iter=-1, probability=False, random_state=None, shrinking=True,
tol=0.001, verbose=False)
In [7]: svc.classes_
Out[7]: array([1, 2])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question