Question: What's wrong with my code? I Got the following feedback : Test Failed: The SVM classifier evaluation metrics are not found because evaluate _ svm
What's wrong with my code?
I Got the following feedback :
"Test Failed: The SVM classifier evaluation metrics are not found because evaluatesvmclassifier function is not implemented or not working as intended."
In : from sklearn.svm import SVC
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import accuracyscore, precisionscore, recallscore, confusionmatrix
def evaluatesvmclassifierXtrain, ytrain, Xtest, ytest:
evaluatesvmclassifier SVCkernel 'linar
evaluatesvmclassifier.fitXtrain, ytrain
ypred evaluatesvmclassifier.predictXtest
precision precisionscore ytest, ypred
recall recallscore ytest, ypred
accuracy accuracyscore ytest, ypred
slope evaluatesvmclassifier.coef evaluatesvmclassifier.coef
intercept evbar a lubar a esvmclassifirinterceptvaluatesvmclassifier.coef
falsepositives, falsenegatives confusionmatrixytest, ypredravel
Trains an SVM classifier with a linear kernel on the training set and evaluates its performance on the test set.
Parameters:
xtrain: Training data features.
ytrain: Training data labels.
Xtest: Test data features.
ytest: Test data labels.
Returns:
slope and intercept of the decision boundary.
Accuracy, precision, recall on the test set.
Number of false positives and false negatives.
return slope, intercept, accuracy, precision, recall, falsepositives, falsenegatives
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
