Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
204 views
in Technique[技术] by (71.8m points)

python 3.x - SVM produces 0 False Positives and True Positives

I am working with Kaggle's Churn Modeling Dataset (https://www.kaggle.com/shrutimechlearn/churn-modelling), trying to predict customers who are going to leave the service.

The initial dataset looks like this:

RowNumber  CustomerId   Surname  CreditScore Geography Gender  Age  
 0          1    15634602  Hargrave          619    France  Female   42  

After wrangling the data, the dataset looks like this:

CreditScore Age Tenure  Balance NumOfProducts   HasCrCard   IsActiveMember  EstimatedSalary Germany Spain   Male
       0    619 42  2   0.00    1                  1        1               101348.88       0           0     0

I then split the data:

from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test = train_test_split(X,y, test_size=0.25, random_state = 0)

... fit and predict the model:

from sklearn import svm
svm_model = svm.SVC()
svm_fit = svm_model.fit(X_train, y_train)
svm_prediction = svm_fit.predict(X_test)

... and trying to cross validate: print(metrics.confusion_matrix(y_test, svm_prediction))

But the confusion matrix looks like this:

[[1991    0]
 [ 509    0]]

Why do I get 0 0 False Positives and 0 True Positives?

question from:https://stackoverflow.com/questions/65863757/svm-produces-0-false-positives-and-true-positives

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...