This code shows how to use cross-validation for a regression problem in which somebody is looking forward to use artificial neural networks. It's actually a random dataset that has been generated. The ANN is a model that has been developed previously. The structures is as follows:
- libraries installation, imports, etc.
- Definition of the random dataset
- Train/Test split
- ANN definition
- KFold and estimator definition. The estimator has been made with SciKeras library
- Prediction/ fitting
- Download the code
- Make sure that you installed:
- Tensorflow. The code was developed with Python 3.11
- Scikeras (documentation: https://adriangb.com/scikeras/stable/)
- SK-Learn
There are several point to tweek. At least for me, the most important are the following ones:
- K divisions
- Model ANN
Please let us know by writing it down and your thoughts about what caused that bug. Try to explain as much as you can. It will be very appreciate it
Other cross-validation techniques will be tests too.
www.educative.io/answers/how-to-implement-crossvalpredict-in-sklearn
scikit-learn.org/stable/modules/generated/sklearn.model_selection.cross_val_predict.html