I Come from a predominantly python + scikit learn background, and I was wondering how would one obtain the cross validation accuracy for a logistic regression model in R? I was searching and surprised that there's no easy way to this. I'm looking for the equivalent:
import pandas as pd
from sklearn.cross_validation import cross_val_score
from sklearn.linear_model import LogisticRegression
## Assume pandas dataframe of dataset and target exist.
scores = cross_val_score(LogisticRegression(),dataset,target,cv=10)
print(scores)
For R: I have:
model = glm(df$Y~df$X,family=binomial')
summary(model)
And now I'm stuck. Reason being, the deviance for my R model is 1900, implying its a bad fit, but the python one gives me 85% 10 fold cross validation accuracy.. which means its good. Seems a bit strange... So i wanted to run cross val in R to see if its the same result.
Any help is appreciated!