I was trying out Kernal PCA using sklearn library on heart disease dataset from kaggle (https://www.kaggle.com/ronitf/heart-disease-uci)so, I have created a list of all the types of kernals in list "P" and passed into the KernalPCA() method to parameter kernel.
When I execute the below code I get this error message attached after the code.
The outputs of the plot are completely fine but I get the error
I was curious why? Could anyone please help?
from sklearn import decomposition
from sklearn.preprocessing import StandardScaler
from scipy import sparse
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import seaborn as sns
df = pd.read_csv('heart.csv')
target = df['target']
df.head()
Scaler = StandardScaler()
# X represents Standardized data of df
X = Scaler.fit_transform(df)
X.shape
n=2
p = ['linear','poly','rbf','sigmoid','cosine','precomputed']
for i in p:
trans = decomposition.KernelPCA(n_components=n,kernel=i)
Xli = trans.fit_transform(X)
y = pd.DataFrame(Xli,columns=('PC1','PC2'))
y['Target'] = target
