Untitled
import tensorflow as tf from tensorflow import keras import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.svm import SVC # Load dataset ds = pd.read_csv("bill_authentication.csv") # Normalize the data bnorm = (ds - ds.min() - 1) / (ds.max() - ds.min()) # Extract target and features target = ds.pop("Class") y = target.values x = bnorm.values # Split the data into training and testing sets x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.3) # Build the model svmclassifier=SVC(kernel='linear') # Train the model and capture the history svmclassifier.fit(x_train,y_train) # Evaluate the model on the test set y_pred=svmclassifier.predict(x_test) print("Test Loss:", y_pred
Leave a Comment