Skip to content

MedSamplingStrategy

A Class that controls how to create MedSamplesfrom MedRegistryby sampling methods. it has several subclasses, each has it's own parameters and logic to sample the samples form registry: Code is documented here. do_sample aruments in MedSamplingRegistry:

  • const vector<MedRegistryRecord> &registry - the registry for the labeling the samples by the sampler (already initialized with sampling params)
  • MedSamples &samples - the samples result
  • const vector< MedRegistryRecord > *censor_registry - optional arg for specifying censoring times for the sampling

Important Samplers:

**** - can be used by specifying MedSamplingRegistry::make_sampler("time_window"). from the updated documentition reffer to doxygen Used to sample for each registry record randomly withing a specific time window. It can define diffrent time windows for cases/controls. Parameters:

Parmeter Name Type Description Default Value
sample_count int how many samples to sample from each registry record. 1
minimal_time_case int the minimal time to give prediciton before the case outcomeTime 0
maximal_time_case int the maximal time to give predicition before the case outcomeTime 0
minimal_time_control int the minimal time to give prediciton before the control outcomeTime (which marks the last time we know the patient is control) 0
maximal_time_control int the maximal time to give prediciton before the control outcomeTime (which marks the last time we know the patient is control) 0
take_max bool If True will take maximal time window for case/control 0

MedSamplingYearly - can be used by specifying MedSamplingRegistry::make_sampler("yearly"). from the updated documentition reffer to doxygen  Used to sample from year to year by jumping periodically between sample times for each patient. for sampling in ICU (more generic sampler for sampling in Fixed time, please reffer to MedSamplingFixedTime) The arguments: time_from, time_to, conflict_method, outcome_interaction_mode, censor_interaction_mode - are common in almost all samplers.

Parmeter Name Type Description Default Value
start_year int the start year to sample from 0 - Must be provided
end_year int The end year to sample from 0 - Must be provided
prediction_month_day int the prediction date for the first year to start sampling 101 - mean 01/01
day_jump int the period of days to jump between each sampling date 0 - Must be provided, the common value should be 365 to jump yearly between sample times
back_random_duration int random time to sample backward from the prediction date - adds ability to sample in random times in the year 0

MedSamplingDates - Provides way to list all sampling options for each patient (or general options list) in a text file and sample randomly from those options MedSamplingStick - can sample on sticked signal times (fetches the signal times and uses MedSamplingDates to do the sampling)

Parmeter Name Type Description Default Value
signal_list string a comma "," delimeted list with signals to list all possible sampling times for patient to stick to "" Must be provided
take_count int how many samples to sample for each patient (inherited from MedSamplingDates). 0 - means take all samples 1
sample_with_filters bool Whether to use the filters as constraints and sample only when valid (may cause bais) or sample totally random and filter later True