gpt4 book ai didi

python - “模块”对象没有属性 'svc'

转载 作者:太空狗 更新时间:2023-10-30 01:47:59 26 4
gpt4 key购买 nike

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.cross_validation import train_test_split
train, test = train_test_split(df, train_size = 0.8)
train
test

x_column=['Userid','day_of_week','hour_of_day','minute_of_hour']
y_column = ['thermostat']

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

我收到一个错误 AttributeError: 'module' object has no attribute 'svc'。尝试了很多技术,但都没有用。我是 python 的新手,非常感谢您的帮助

最佳答案

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

注意大写 C

参见 docs .

关于python - “模块”对象没有属性 'svc',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40604568/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com