“模块"对象没有属性“svc" [英] 'module' object has no attribute 'svc'

查看:96
本文介绍了“模块"对象没有属性“svc"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 新手,非常感谢您的帮助

I'm getting an error AttributeError: 'module' object has no attribute 'svc'. Tried many techniques, but none of them are working. I'm new to python, and would really appreciate the help

推荐答案

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

注意大写C.

请参阅文档.

这篇关于“模块"对象没有属性“svc"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆