CMP++: Uncertainty Quantification & Bayesian Calibration
Loading...
Searching...
No Matches
cmp::statistics::KFold::KFoldIterator Class Reference

Iterator class to traverse folds for K-Fold cross-validation. More...

#include <statistics.h>

Collaboration diagram for cmp::statistics::KFold::KFoldIterator:

Public Member Functions

 KFoldIterator (const KFold &kf, Eigen::Index split)
 Constructs a KFoldIterator.
 
bool operator!= (const KFoldIterator &other) const
 Checks inequality with another iterator (used for loop termination).
 
std::pair< Eigen::VectorXs, Eigen::VectorXsoperator* () const
 Dereferences the iterator to compute training and test index sets for the current fold.
 
KFoldIteratoroperator++ ()
 Increments the iterator to point to the next fold.
 

Private Attributes

Eigen::Index currentSplit_
 The current active fold index \( k \).
 
const KFoldparent_
 Reference to the parent KFold object to access index arrays and sizes.
 

Detailed Description

Iterator class to traverse folds for K-Fold cross-validation.

Constructor & Destructor Documentation

◆ KFoldIterator()

cmp::statistics::KFold::KFoldIterator::KFoldIterator ( const KFold kf,
Eigen::Index  split 
)
inline

Constructs a KFoldIterator.

Parameters
kfReference to the parent KFold object.
splitIndex of the current split/fold.

Member Function Documentation

◆ operator!=()

bool cmp::statistics::KFold::KFoldIterator::operator!= ( const KFoldIterator other) const
inline

Checks inequality with another iterator (used for loop termination).

Parameters
otherThe iterator to compare against.
Returns
True if iterators point to different splits, false otherwise.

◆ operator*()

std::pair< Eigen::VectorXs, Eigen::VectorXs > cmp::statistics::KFold::KFoldIterator::operator* ( ) const
inline

Dereferences the iterator to compute training and test index sets for the current fold.

Returns
A std::pair containing {train_indices, test_indices} as Eigen vectors.

◆ operator++()

KFoldIterator & cmp::statistics::KFold::KFoldIterator::operator++ ( )
inline

Increments the iterator to point to the next fold.

Returns
Reference to the incremented iterator.

Member Data Documentation

◆ currentSplit_

Eigen::Index cmp::statistics::KFold::KFoldIterator::currentSplit_
private

The current active fold index \( k \).

◆ parent_

const KFold& cmp::statistics::KFold::KFoldIterator::parent_
private

Reference to the parent KFold object to access index arrays and sizes.


The documentation for this class was generated from the following file: