Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
Lazy_Iterator Class Reference

A class which fetches the samples in bootstrap manner in lazy way. More...

#include <bootstrap.h>

Public Member Functions

 Lazy_Iterator (const vector< int > *p_pids, const vector< float > *p_preds, const vector< float > *p_y, const vector< float > *p_w, float p_sample_ratio, int p_sample_per_pid, int max_loops, int seed, const vector< int > *p_preds_order=NULL)
 The Ctor.
 
void init (const vector< int > *p_pids, const vector< float > *p_preds, const vector< float > *p_y, const vector< float > *p_w, float p_sample_ratio, int p_sample_per_pid, int max_loops, int seed)
 
bool fetch_next (int thread, float &ret_y, float &ret_pred, float &weight)
 Inline function to fetch next pred,label couple in the bootstrap process.
 
bool fetch_next (int thread, float &ret_y, const float *&ret_pred, float &weight, const int *&preds_order)
 
bool fetch_next_external (int thread, float &ret_y, float &ret_pred, float &weight)
 external function to fetch next pred,label couple in the bootstrap process for external implementitions
 
bool fetch_next_external (int thread, float &ret_y, float &ret_pred, float &weight, const int *&preds_order)
 external function to fetch next pred,label couple in the bootstrap process for external implementitions
 
void restart_iterator (int thread)
 to restart the iterator
 
void set_static (const vector< float > *p_y, const vector< float > *p_preds, const vector< float > *p_w, const vector< int > *p_preds_order, int thread_num)
 set the bootstrap to retrieve those vectors p_y,p_preds with no randomizations
 
void set_thread_sample_all (int thread)
 

Data Fields

float sample_ratio
 the sample ratio of the patients out of all patients in each bootstrap
 
int sample_per_pid
 how many samples to take for each patients. 0 - means no sampling take all sample for patient
 
bool sample_all_no_sampling
 for calcing Obs if true
 
size_t num_categories
 number of categories (inferred)
 

Detailed Description

A class which fetches the samples in bootstrap manner in lazy way.


The object doesn't creates vectors for labels,scores in each bootstrap but fetches the samples in randomization without creating memory allocation

Constructor & Destructor Documentation

◆ Lazy_Iterator()

Lazy_Iterator::Lazy_Iterator ( const vector< int > *  p_pids,
const vector< float > *  p_preds,
const vector< float > *  p_y,
const vector< float > *  p_w,
float  p_sample_ratio,
int  p_sample_per_pid,
int  max_loops,
int  seed,
const vector< int > *  p_preds_order = NULL 
)

The Ctor.

Parameters
p_pidsa reference to the ids vector
p_predsa reference to the predicitons vector
p_ya reference to the labels vector
p_sample_ratioa sample ratio parameter for the bootstrap (0-1]
p_sample_per_pida sample count per patient
max_loopsa maximal number of accessing the bootstrap (num of threads or the bootstrap loop count).
seedif 0 will use random device to select seed for randomization

Member Function Documentation

◆ set_static()

void Lazy_Iterator::set_static ( const vector< float > *  p_y,
const vector< float > *  p_preds,
const vector< float > *  p_w,
const vector< int > *  p_preds_order,
int  thread_num 
)

set the bootstrap to retrieve those vectors p_y,p_preds with no randomizations

Parameters
p_ya pointer to array labels
p_predsa pointer to array predictions
thread_numan access point to the bootstrap state - thread_numbeer or bootstrap loop count

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