I have a problem with this code:
from sklearn import svm
model_SVC = SVC()
model_SVC.fit(X_scaled_df_train, y_train)
svm_prediction = model_SVC.predict(X_scaled_df_test)
The error message is
NameError
Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_14392/1339209891.py in ----> 1 svm_prediction = model_SVC.predict(X_scaled_df_test)NameError: name 'model_SVC' is not defined
Any ideas?
CodePudding user response:
use:
from sklearn.svm import SVC
CodePudding user response:
The line from sklearn import svm
was incorrect. The correct way is
from sklearn.svm import SVC
The documentation is sklearn.svm.SVC. And when I choose this model, I'm mindful of the dataset size. Extracted:
The fit time scales at least quadratically with the number of samples and may be impractical beyond tens of thousands of samples. For large datasets consider using LinearSVC instead.
from sklearn.svm import LinearSVC
For more info you could read When should one use LinearSVC or SVC?