Understanding Python SKlearn Run Errors

Asked 2 years ago, Updated 2 years ago, 36 views

When I was performing sklearn to learn machine learning text, I received the following error:
Please advise me on how I can avoid it.
In addition, the code described is executed by entering the code described in the book.
We have installed all the necessary libraries in the text.

from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn import svm, datasets, model_selection

iris=datasets.load_iris()

x = iris.data
y = iris.target

svc=svm.SVC (C=1, kerne1="rbf", gamma=0.001)

Run Results

TypeError Traceback (most recent call last)
<ipython-input-25-3ab815fd6dea>in<module>
     10 
     11# Use the machine learning algorithm SVM.
--- > 12 svc = svm.SVC (C=1, kerne1 = "rbf", gamma = 0.001)

TypeError: __init__()got an unexpected keyword argument 'kernel1'

python python3

2022-09-30 19:28

1 Answers

Because the argument kerne1 is not defined in the SVC function.
Try changing it to kernel

https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html


2022-09-30 19:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.