[Python] Support vector machine overfitting my data [closed]

Discussão em 'Python' iniciado por Stack, Fevereiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to make predictions for the iris dataset. I have decided to use svms for this purpose. But, it gives me an accuracy 1.0. Is it a case of overfitting or is it because the model is very good? Here is my code.

    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
    svm_model = svm.SVC(kernel='linear', C=1,gamma='auto')
    svm_model.fit(X_train,y_train)
    predictions = svm_model.predict(X_test)
    accuracy_score(predictions, y_test)


    Here, accuracy_score returns a value of 1. Please help me. I am a beginner in machine learning.

    Continue reading...

Compartilhe esta Página