Predicting probability

后端 未结 2 571
猫巷女王i
猫巷女王i 2021-01-07 00:42

Trying to use SVC from sklearn to do a classification problem. Given a bunch of data, and information telling me whether some subject is in a certa

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-07 01:03

    You have to construct the SVC object with probability=True

    from sklearn.svm import SVC
    clf=SVC(probability=True)
    clf.fit(X,Y)
    print clf.predict_proba(W) #No error
    

    Your code creates a SVC with probability estimates and discards it (as you do not store it in any variable) and use some previous SVC stored in clf (without probability)

提交回复
热议问题