Bank account predict program

Hello everyone, We gonna make together bank account prediction program

Lets start download dataset

http://www.mediafire.com/file/nug4f84hx09mppi/bank.csv/file

Lets then we import librarys

import pandas as pd
import numpy as np

from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.svm import SVR
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score

df = pd.read_csv("bank.csv",sep=";")
df = df.dropna()
y = df["y"]
X = df.drop(["y"], axis = 1)
X_train, X_test, y_train, y_test = train_test_split(X, 
                                                    y, 
                                                    test_size=0.30, 
                                                    random_state=42)
svm_model = SVC(kernel = "linear").fit(X_train, y_train)
y_pred = svm_model.predict(X_test)
accuracy_score(y_test, y_pred)
svm = SVC()

svm_params = {"C": np.arange(1,10), "kernel": ["linear","rbf","poly"]}
svm_cv_model = GridSearchCV(svm, svm_params, cv = 5, n_jobs = -1, verbose = 2).fit(X_train, y_train)
svm_cv_model.best_score_
svm_cv_model.best_params_
svm_tuned = SVC(C = 6, kernel = "poly").fit(X_train, y_train)
y_pred = svm_tuned.predict(X_test)
accuracy_score(y_test, y_pred)
30,0,0,1,0,0,0,0,0,0,0,0,0,79,1,0,1787,0,0,-1,0

x_degerler = np.array([[30,0,0,1,0,0,0,0,0,0,0,0,0,79,1,0,1787,0,0,-1,0]])
print("x_yeni: {}".format(x_degerler.shape))

prediction = svm_tuned.predict(x_degerler)
print("tahmin: {}".format(prediction))

Thets mean : y – has the client subscribed a term deposit? (binary: “yes”,”no”)

This prdiction result is 0

Bir yanıt yazın