Logistic regression after pca
#from sklearn.datasets import fetch_mldata fr om sklearn.decomposition import PC A from sklearn import metrics import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.preprocessing import StandardScaler import numpy as np df = pd.read_csv('mnist_test.csv') df_x = df.iloc[:,1:] df_y = df.iloc[:,0] print(df_x.shape,df_y.shape) from sklearn.model_selection import train_test_split x_train,x_test,y_train,y_test = train_test_split(df_x,df_y,test_size=0.2,random_state=0) print(x_train.shape,x_test.shape) print(y_train.shape,y_test.shape) benchmark = [.95,.90,.85,0.80,0.75,0.70,0.60] #standardise the data scl = StandardScaler() scl.fit(x_train) x_train = scl.transform(x_train) x_test = scl.transform(x_test) #lets create pandas dataframe that contains variance_reatined,n_components,accuracy and time cols = ['variance','n_comp','time','accuracy'] df_result = pd.DataFrame(columns=cols) import time def pca_applier(variance,x_tra...