phenotrex.transforms package¶
Submodules¶
phenotrex.transforms.annotation module¶
phenotrex.transforms.resampling module¶
-
class
phenotrex.transforms.resampling.
TrainingRecordResampler
(random_state: float = None, verb: bool = False)[source]¶ Bases:
object
Instantiates an object which can generate versions of a TrainingRecord resampled to defined completeness and contamination levels. Requires prior fitting with full List[TrainingRecord] to get sources of contamination for both classes.
- Parameters
random_state – Randomness seed to use while resampling
verb – Toggle verbosity
-
fit
(records: List[phenotrex.structure.records.TrainingRecord])[source]¶ Fit TrainingRecordResampler on full TrainingRecord list to determine set of positive and negative features for contamination resampling.
- Parameters
records – the full List[TrainingRecord] on which ml training will commence.
- Returns
True if fitting was performed, else False.
-
get_resampled
(record: phenotrex.structure.records.TrainingRecord, comple: float = 1, conta: float = 0) → phenotrex.structure.records.TrainingRecord[source]¶ Resample a TrainingRecord to defined completeness and contamination levels. Comple=1, Conta=1 will double set size.
- Parameters
comple – completeness of returned TrainingRecord features. Range: 0 - 1
conta – contamination of returned TrainingRecord features. Range: 0 - 1
record – the input TrainingRecord
- Returns
a resampled TrainingRecord.