text_plain_output_1.png
from sklearn.impute import SimpleImputer

from sklearn.metrics import confusion_matrix

from sklearn.model_selection import cross_val_score, cross_val_predict

from sklearn.preprocessing import MinMaxScaler

from sklearn.svm import LinearSVC, SVC  # Linear Support Vector Classification

import numpy as np

import pandas as pd

import pandas as pd
import numpy as np
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import cross_val_score, cross_val_predict
from sklearn.svm import LinearSVC, SVC
RANDOM_STATE = 1234

payments = pd.read_csv('../input/credit-risk-classification-dataset/payment_data.csv')
payments = payments.set_index('id')
customers = pd.read_csv('../input/credit-risk-classification-dataset/customer_data.csv')
customers = customers.set_index('id')
customer_data = customers.join(payments)
customer_data

customer_data.isnull().sum(axis=0)

customer_data = customer_data.drop(['prod_limit', 'report_date', 'update_date', 'prod_code', 'fea_1', 'fea_3', 'fea_5', 'fea_6', 'fea_7', 'fea_9'], axis=1)

data = customer_data.to_numpy(na_value=np.nan).astype(float)
imputer = SimpleImputer(verbose=1)
data = imputer.fit_transform(data)
data

scaler = MinMaxScaler()
data = scaler.fit_transform(data)

X = data[:, 1:]
y = data[:, 0]

linear_model = LinearSVC(random_state=RANDOM_STATE)
cross_val_score(linear_model, X, y, cv=3, n_jobs=-1, scoring='accuracy')

pred_tags = cross_val_predict(linear_model, X, y, cv=3, n_jobs=-1, method='predict')

poly_svc = SVC(kernel='poly', random_state=RANDOM_STATE)
pred_tags = cross_val_predict(poly_svc, X, y, cv=3, n_jobs=-1, method='predict')
confusion_matrix(y, pred_tags)