'module' object has no attribute 'svc'

前端 未结 6 425
野性不改
野性不改 2021-01-19 02:14
import pandas as pd
from sklearn import svm

### Read the CSV ###
df = pd.read_csv(\'C:/Users/anagha/Documents/Python Scripts/sampleData.csv\')
df

from sklearn.cros         


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-19 02:48

    Your problem originate from the fact that you call:

    model = svm.svc(kernel='linear', c=1, gamma=1) 
    

    with lowercase svc in svm.svc, which should be svm.SVC. Additionally, as Alex Hall noted, you call c=1 with in lower case which should be C=1. Giving:

    model = svm.SVC(kernel='linear', C=1, gamma=1) 
    

提交回复
热议问题