Why is cross_val_score not producing consistent results?

When this code executes the results are not consistent. Where is the randomness coming from? from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA from sklearn.tree import DecisionTreeClassifier from sklearn.pipeline import Pipeline from sklearn.model_selection import KFold from sklearn.model_selection import cross_val_score seed = 42 iris = datasets.load_iris() X =… Read More Why is cross_val_score not producing consistent results?

Can't get LogisticRegressionCV to converge for any other Cs then 1

I’m trying to build a logistic regression model with an array of hyperparameter values such as: lambdas = [0.001, 0.01, 0.05, 0.1, 1., 100.] However, the model won’t converge unless i have Cs = 1.Here is my code: X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=0.2,random_state=42) lambdas = [0.001, 0.01, 0.05, 0.1, 1., 100.] RidgeCV… Read More Can't get LogisticRegressionCV to converge for any other Cs then 1

xgboost cross validation – accuracy metrics

I’m doing cross validation on xgboost. Here is my code. from xgboost import cv xgb_cv = cv(dtrain=data_dmatrix, params=params, nfold=10, num_boost_round=50, early_stopping_rounds=10, metrics="auc", as_pandas=True, seed=1) Is there any way to have "accuracy" metrics? I couldn’t find any "accuracy" option for "metrics" in the documentation. >Solution : The accuracy is 1 – the error rate (metrics =… Read More xgboost cross validation – accuracy metrics

How to visualise my RF model's performance in R, based on the cross-validation?

I have a model the the following example and I want to show its stability and consistency/performance through the k-folds. What is the best visualization/interpretation for this purpose? data(iris) mydf=iris[,1:4] control = trainControl(method="repeatedcv", number=5,repeats=5,savePredictions = TRUE) for_train = createDataPartition(mydf$Sepal.Length, p=.66, list=FALSE) train=mydf[for_train,] test=mydf[-for_train,] mytrf_iris = train(Sepal.Length~ ., data=train,ntree=800,method="rf",metric="Rsquared",trControl=control,importance = TRUE) >Solution : library(caret) #> Loading… Read More How to visualise my RF model's performance in R, based on the cross-validation?