Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A problem about k_fold_number #136

Open
orangesmellbear opened this issue Oct 25, 2022 · 3 comments
Open

A problem about k_fold_number #136

orangesmellbear opened this issue Oct 25, 2022 · 3 comments

Comments

@orangesmellbear
Copy link

Dear Wu Jie:
It's a great projects!
I have a question about k_fold_number.
In the code"parser.add_argument('--fold', default=1, type=int, help='k fold number')", if default=5, does the training represent 5 fold cross validation?Why in k_ fold_ In train, the value of "-- fold" is not fixed but (i+1)?
Or does 10 fold cross validation mean that the value of "-- fold" is taken from 1 to 10 for training, and then the average value of 10 training results is taken?Can you explain it to me?
Best wishes!

@AKASHKRISHNABHUKYA
Copy link

The k_fold_number in the code represents the number of folds for performing k-fold cross-validation. The k in k-fold cross-validation refers to the number of folds.

In the code parser.add_argument('--fold', default=1, type=int, help='k fold number'), the default argument is set to 1, which means that by default, the program will perform 1-fold cross-validation. If the value of --fold is set to 5, for example, then the program will perform 5-fold cross-validation.

In k-fold cross-validation, the dataset is divided into k equal-sized parts, or folds. The model is trained on k-1 folds, and the remaining fold is used as the validation set. This process is repeated k times, with each fold being used once as the validation set. The final performance metric is then averaged over all k runs.

In the code, the i in k_fold_train(i) is used to keep track of which fold is being used for validation in each iteration. So if k_fold_number=10, then k_fold_train will be called 10 times, with i ranging from 0 to 9. On each iteration, the i-th fold will be used as the validation set, and the remaining k-1 folds will be used for training. The final result is the average of the performance metrics obtained from each iteration.

I hope this helps clear up your understanding of the k_fold_number in the code.

@orangesmellbear
Copy link
Author

@AKASHKRISHNABHUKYA Thanks for your help! It's a great explanation.

@Ibtissam-SAADI
Copy link

thanks for your explanation! but what about the test set?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants