301 - Evaluating keras model using KFold cross validation​

DigitalSreeni
DigitalSreeni
10.4 هزار بار بازدید - 2 سال پیش - Code generated in the video
Code generated in the video can be downloaded from here: github.com/bnsreenu/python_for_microscopists Direct link: github.com/bnsreenu/python_for_microscopists/tree/… We will start with the normal way most of us approach the problem of binary classification using neural networks (deep learning). In this example, we will split our data set the normal way into train and test groups. Then, we will learn to divide data using K Fold splits. We will iterate through each split to train and evaluate our model. Normally, we would use cross_val_score in sklearn to automatically evaluate the model over all splits and report the cross validation score. But, that method is designed to handle traditional sklearn models such as SVM, RF, gradient boosting etc. - NOT deep learning models from TensorFlow or pytorch. Therefore, in order to use cross_val_score, we will find a way to make our keras model available to the function. This is done using the KerasClassifier from tensorflow.keras.wrappers.scikit_learn Note that the cross_val_score() function takes the dataset and cross-validation configuration and returns a list of scores calculated for each fold. Wisconsin breast cancer example Dataset link: www.kaggle.com/datasets/uciml/breast-cancer-wiscon…
2 سال پیش در تاریخ 1402/01/09 منتشر شده است.
10,406 بـار بازدید شده
... بیشتر