I am trying to fit a binary logistic model using MNIST data using glm function. I am getting an error "Failed to converge". should apply any transformations before I fit the model?
Here is the link for my dataset MNIST DATASET
df<-read.csv('mnist_train.csv')
#assigning column names
names(df)<-c(1:785)
#Relabeld the data with values
#If the digit is 9 then its labeled as 1 else its labled as 0
df$`1`<-factor(df$`1`,levels=c(1,2,3,4,5,6,7,8,9),labels=c(0,0,0,0,0,0,0,0,1))
#Removed null values
cldf<-df[complete.cases(df),]
#fitting model
model<-glm(cldf$`1`~.,family =binomial(link = "logit"),data=cldf)
summary(model)
I read the following references but solution provided is not my case as I am using 0 and 1 as labels. Logistic Regression implementation with MNIST - not converging? Below are the warning messages I got:
1: glm.fit: algorithm did not converge
2: glm.fit: fitted probabilities numerically 0 or 1 occurred
Any directions would be appreciated.