MedPython package

MedPython module

class med.Bootstrap(Bootstrap self) Bootstrap[source]

Bases: object

Proxy of C++ MPBootstrap class.

MEDPY_GET_ROC_max_diff_working_point(Bootstrap self) float[source]
MEDPY_GET_ROC_score_bins(Bootstrap self) int[source]
MEDPY_GET_ROC_score_min_samples(Bootstrap self) int[source]
MEDPY_GET_ROC_score_resolution(Bootstrap self) float[source]
MEDPY_GET_ROC_use_score_working_points(Bootstrap self) bool[source]
MEDPY_GET_ROC_working_point_FPR(Bootstrap self) FloatVector[source]
MEDPY_GET_ROC_working_point_PR(Bootstrap self) FloatVector[source]
MEDPY_GET_ROC_working_point_SENS(Bootstrap self) FloatVector[source]
MEDPY_GET_ROC_working_point_Score(Bootstrap self) FloatVector[source]
MEDPY_GET_ROC_working_point_TOPN(Bootstrap self) IntVector[source]
MEDPY_GET_nbootstrap(Bootstrap self) int[source]
MEDPY_GET_sample_per_pid(Bootstrap self) int[source]
MEDPY_SET_ROC_max_diff_working_point(Bootstrap self, float _ROC_max_diff_working_point)[source]
MEDPY_SET_ROC_score_bins(Bootstrap self, int _ROC_score_bins)[source]
MEDPY_SET_ROC_score_min_samples(Bootstrap self, int _ROC_score_min_samples)[source]
MEDPY_SET_ROC_score_resolution(Bootstrap self, float _ROC_score_resolutiont)[source]
MEDPY_SET_ROC_use_score_working_points(Bootstrap self, bool _ROC_use_score_working_points)[source]
MEDPY_SET_ROC_working_point_FPR(Bootstrap self, FloatVector _ROC_working_point_FPR)[source]
MEDPY_SET_ROC_working_point_PR(Bootstrap self, FloatVector _ROC_working_point_PR)[source]
MEDPY_SET_ROC_working_point_SENS(Bootstrap self, FloatVector _ROC_working_point_SENS)[source]
MEDPY_SET_ROC_working_point_Score(Bootstrap self, FloatVector _ROC_working_point_Score)[source]
MEDPY_SET_ROC_working_point_TOPN(Bootstrap self, IntVector MEDPY_GET_ROC_working_point_TOPN)[source]
MEDPY_SET_nbootstrap(Bootstrap self, int _nbootstrap)[source]
MEDPY_SET_sample_per_pid(Bootstrap self, int _sample_per_pid)[source]
property ROC_max_diff_working_point

MEDPY_GET_ROC_max_diff_working_point(Bootstrap self) -> float

property ROC_score_bins

MEDPY_GET_ROC_score_bins(Bootstrap self) -> int

property ROC_score_min_samples

MEDPY_GET_ROC_score_min_samples(Bootstrap self) -> int

property ROC_score_resolution

MEDPY_GET_ROC_score_resolution(Bootstrap self) -> float

property ROC_use_score_working_points

MEDPY_GET_ROC_use_score_working_points(Bootstrap self) -> bool

property ROC_working_point_FPR

MEDPY_GET_ROC_working_point_FPR(Bootstrap self) -> FloatVector

property ROC_working_point_PR

MEDPY_GET_ROC_working_point_PR(Bootstrap self) -> FloatVector

property ROC_working_point_SENS

MEDPY_GET_ROC_working_point_SENS(Bootstrap self) -> FloatVector

property ROC_working_point_Score

MEDPY_GET_ROC_working_point_Score(Bootstrap self) -> FloatVector

property ROC_working_point_TOPN

MEDPY_GET_ROC_working_point_TOPN(Bootstrap self) -> IntVector

bootstrap_cohort(Bootstrap self, Samples samples, string const & rep_path, string const & json_model, string const & cohorts_path) StringBtResultMap[source]
get_cohort_from_arg(Bootstrap self, string const & single_cohort)[source]
init_from_str(Bootstrap self, string const & str)[source]
property nbootstrap

MEDPY_GET_nbootstrap(Bootstrap self) -> int

parse_cohort_file(Bootstrap self, string const & cohorts_path)[source]
parse_cohort_line(Bootstrap self, string const & line)[source]
property sample_per_pid

MEDPY_GET_sample_per_pid(Bootstrap self) -> int

property thisown

The membership flag

class med.CommonLib(CommonLib self) CommonLib[source]

Bases: object

Proxy of C++ MPCommonLib class.

static print_auc_performance(Samples samples, int * folds, string outFile)[source]
static read_predictor_from_file(Predictor pred, string predictorFile)[source]
static shuffleMatrix(Features matrix)[source]
property thisown

The membership flag

class med.Dictionary(Dictionary self, PidRepository rep) Dictionary[source]

Bases: object

Proxy of C++ MPDictionary class.

get_members_to_all_sets(Dictionary self, int section_id, int * members_array) IntVecIntMapAdaptor[source]
id(Dictionary self, int section_id, string & signame) int[source]
name(Dictionary self, int section_id, int id) string[source]
prep_sets_lookup_table(Dictionary self, int section_id, StringVector set_names)[source]
section_id(Dictionary self, string name) int[source]
property thisown

The membership flag

class med.FeatureAttr(FeatureAttr self) FeatureAttr[source]

Bases: object

Proxy of C++ MPFeatureAttr class.

MEDPY_GET_denorm_mean(FeatureAttr self) float[source]
MEDPY_GET_denorm_sdv(FeatureAttr self) float[source]
MEDPY_GET_imputed(FeatureAttr self) bool[source]
MEDPY_GET_normalized(FeatureAttr self) bool[source]
MEDPY_SET_denorm_mean(FeatureAttr self, float _denorm_mean)[source]
MEDPY_SET_denorm_sdv(FeatureAttr self, float _denorm_sdv)[source]
MEDPY_SET_imputed(FeatureAttr self, bool _imputed)[source]
MEDPY_SET_normalized(FeatureAttr self, bool _normalized)[source]
asSerializable(FeatureAttr self) SerializableObject[source]
property denorm_mean

MEDPY_GET_denorm_mean(FeatureAttr self) -> float

property denorm_sdv

MEDPY_GET_denorm_sdv(FeatureAttr self) -> float

property imputed

MEDPY_GET_imputed(FeatureAttr self) -> bool

property normalized

MEDPY_GET_normalized(FeatureAttr self) -> bool

property thisown

The membership flag

class med.Features(Features self) Features[source]
class med.Features(Features self, int _time_unit) Features
class med.Features(Features self, Features other) Features

Bases: object

Proxy of C++ MPFeatures class.

MEDPY_GET_attributes(Features self) StringFeatureAttrMapAdaptor[source]
MEDPY_GET_data(Features self) StringVecFloatMapAdaptor[source]
static MEDPY_GET_global_serial_id_cnt() int[source]
MEDPY_GET_pid_pos_len(Features self) IntPairIntIntMapAdaptor[source]
MEDPY_GET_samples(Features self) SampleVectorAdaptor[source]
MEDPY_GET_tags(Features self) StringUOSetStringMapAdaptor[source]
MEDPY_GET_time_unit(Features self) int[source]
MEDPY_GET_weights(Features self)[source]
static MEDPY_SET_global_serial_id_cnt(int newval)[source]
MEDPY_SET_time_unit(Features self, int new_time_unit)[source]
append_samples(Features self, IdSamples in_samples)[source]
append_samples(Features self, Samples in_samples)
asSerializable(Features self) SerializableObject[source]
property attributes

MEDPY_GET_attributes(Features self) -> StringFeatureAttrMapAdaptor

clear(Features self)[source]
property data

MEDPY_GET_data(Features self) -> StringVecFloatMapAdaptor

filter(Features self, StringVector selectedFeatures) int[source]
get_as_matrix(Features self, Mat mat)[source]
get_as_matrix(Features self, Mat mat, StringVector names)
get_as_matrix(Features self, Mat mat, StringVector names, int * int_in_buf)
get_crc(Features self) unsigned int[source]
get_feature_names(Features self) StringVector[source]
get_max_serial_id_cnt(Features self) int[source]
get_pid_len(Features self, int pid) int[source]
get_pid_pos(Features self, int pid) int[source]
get_samples(Features self, Samples outSamples)[source]
property global_serial_id_cnt

MEDPY_GET_global_serial_id_cnt() -> int

init_all_samples(Features self, IdSamplesVectorAdaptor in_samples)[source]
init_pid_pos_len(Features self)[source]
insert_samples(Features self, IdSamples in_samples, int index)[source]
property pid_pos_len

MEDPY_GET_pid_pos_len(Features self) -> IntPairIntIntMapAdaptor

print_csv(Features self)[source]
read_from_csv_mat(Features self, string const & csv_fname) int[source]
property samples

MEDPY_GET_samples(Features self) -> SampleVectorAdaptor

set_as_matrix(Features self, Mat mat)[source]
set_time_unit(Features self, int _time_unit)[source]
split_by_fold(Features self, Features outMatrix, int iFold, bool isLearning)[source]
property tags

MEDPY_GET_tags(Features self) -> StringUOSetStringMapAdaptor

property thisown

The membership flag

property time_unit

MEDPY_GET_time_unit(Features self) -> int

version(Features self) int[source]
property weights

MEDPY_GET_weights(Features self)

write_as_csv_mat(Features self, string const & csv_fname) int[source]
class med.IdSamples(IdSamples self, int _id) IdSamples[source]
class med.IdSamples(IdSamples self) IdSamples

Bases: object

Proxy of C++ MPIdSamples class.

MEDPY_GET_id(IdSamples self) int[source]
MEDPY_GET_samples(IdSamples self) SampleVectorAdaptor[source]
MEDPY_GET_split(IdSamples self) int[source]
MEDPY_SET_id(IdSamples self, int new_id)[source]
MEDPY_SET_split(IdSamples self, int new_id)[source]
asSerializable(IdSamples self) SerializableObject[source]
property id

MEDPY_GET_id(IdSamples self) -> int

same_as(IdSamples self, IdSamples other, int mode) bool[source]
property samples

MEDPY_GET_samples(IdSamples self) -> SampleVectorAdaptor

set_split(IdSamples self, int _split)[source]
property split

MEDPY_GET_split(IdSamples self) -> int

property thisown

The membership flag

class med.Logger(Logger self) Logger[source]

Bases: object

Proxy of C++ MPLogger class.

add_file(Logger self, int section, string const & fname) int[source]
init_all_files(Logger self, string const & fname) int[source]
init_all_levels(Logger self, int level)[source]
init_file(Logger self, int section, string const & fname) int[source]
init_level(Logger self, int section, int level)[source]
init_out(Logger self, string const & fname="")[source]
property thisown

The membership flag

class med.Mat(Mat self) Mat[source]
class med.Mat(Mat self, int n_rows, int n_cols) Mat
class med.Mat(Mat self, float * IN_ARRAY2) Mat

Bases: object

Proxy of C++ MPMat class.

static MEDPY_GET_Normalize_Cols() int[source]
static MEDPY_GET_Normalize_Rows() int[source]
MEDPY_GET_avg(Mat self)[source]
MEDPY_GET_missing_value(Mat self) float[source]
MEDPY_GET_ncols(Mat self) int[source]
MEDPY_GET_normalized_flag(Mat self) int[source]
MEDPY_GET_nrows(Mat self) int[source]
MEDPY_GET_row_ids(Mat self)[source]
MEDPY_GET_signals(Mat self) StringVector[source]
MEDPY_GET_std(Mat self)[source]
MEDPY_GET_transposed_flag(Mat self) int[source]
MEDPY_SET_missing_value(Mat self, float newval)[source]
MEDPY_SET_normalized_flag(Mat self, int newval)[source]
MEDPY_SET_row_ids(Mat self, int * row_ids_buf)[source]
MEDPY_SET_transposed_flag(Mat self, int newval)[source]
add_cols(Mat self, Mat m_add)[source]
add_cols(Mat self, float * m_add)
add_rows(Mat self, Mat m_add)[source]
add_rows(Mat self, float * m_add)
asSerializable(Mat self) SerializableObject[source]
property avg

MEDPY_GET_avg(Mat self)

clear(Mat self)[source]
get_col(Mat self, int i_col)[source]
get_cols_avg_std(Mat self)[source]
get_numpy_copy(Mat self)[source]
get_numpy_view_unsafe(Mat self)[source]
get_row(Mat self, int i_row)[source]
get_sub_mat(Mat self, IntVector rows_to_take, IntVector cols_to_take)[source]
get_sub_mat_by_flags(Mat self, IntVector rows_to_take_flag, IntVector cols_to_take_flag)[source]
is_valid(Mat self, bool output=False) bool[source]
load(Mat self, float * IN_ARRAY2)[source]
load(Mat self, Mat x)
load_numpy(Mat self, float * IN_ARRAY2)[source]
load_transposed(Mat self, float * IN_ARRAY2)[source]
property missing_value

MEDPY_GET_missing_value(Mat self) -> float

property ncols

MEDPY_GET_ncols(Mat self) -> int

normalize(Mat self, int norm_type, float * wgts)[source]
normalize(Mat self, int norm_type=Normalize_Cols)
normalize(Mat self, float * external_avg, float * external_std, int norm_type=1)
property normalized_flag

MEDPY_GET_normalized_flag(Mat self) -> int

property nrows

MEDPY_GET_nrows(Mat self) -> int

read_from_bin_file(Mat self, string const & fname) int[source]
read_from_csv_file(Mat self, string const & fname, int titles_line_flag) int[source]
resize(Mat self, int n_rows, int n_cols)[source]
property row_ids

MEDPY_GET_row_ids(Mat self)

set_signals(Mat self, StringVector sigs)[source]
set_val(Mat self, float val)[source]
property signals

MEDPY_GET_signals(Mat self) -> StringVector

property std

MEDPY_GET_std(Mat self)

test(Mat self, int n_rows, int n_cols)[source]
property thisown

The membership flag

transpose(Mat self)[source]
property transposed_flag

MEDPY_GET_transposed_flag(Mat self) -> int

write_to_bin_file(Mat self, string const & fname) int[source]
write_to_csv_file(Mat self, string const & fname) int[source]
zero(Mat self)[source]
class med.MedConvert(MedConvert self) MedConvert[source]

Bases: object

Proxy of C++ MPMedConvert class.

create_index(MedConvert self, std: :string & conf_fname) int[source]
create_rep(MedConvert self, std: :string const & conf_fname)[source]
init_load_params(MedConvert self, std: :string const & load_args)[source]
property thisown

The membership flag

class med.Model(Model self) Model[source]

Bases: object

Proxy of C++ MPModel class.

MEDPY_GET_features(Model self) Features[source]
MEDPY_GET_verbosity(Model self) int[source]
MEDPY_SET_verbosity(Model self, int new_vval)[source]
add_age(Model self)[source]
add_feature_generator(Model self, string & name, string & signal)[source]
add_feature_generator_to_set(Model self, int i_set, string const & init_string)[source]
add_feature_generators(Model self, string & name, StringVector signals)[source]
add_feature_generators(Model self, string & name, StringVector signals, string init_string)
add_feature_generators(Model self, string & name, string & signal, string init_string)
add_feature_processor_to_set(Model self, int i_set, int duplicate, string const & init_string)[source]
add_gender(Model self)[source]
add_imputers(Model self)[source]
add_imputers(Model self, string init_string)
add_imputers(Model self, StringVector features)
add_imputers(Model self, StringVector features, string init_string)
add_normalizers(Model self)[source]
add_normalizers(Model self, string init_string)
add_normalizers(Model self, StringVector features)
add_normalizers(Model self, StringVector features, string init_string)
add_pre_processors_json_string_to_model(Model self, string in_json, string fname)[source]
add_process_to_set(Model self, int i_set, int duplicate, string const & init_string)[source]
add_process_to_set(Model self, int i_set, string const & init_string)
add_rep_processor_to_set(Model self, int i_set, string const & init_string)[source]
apply(Model self, PidRepository rep, Samples samples) int[source]
apply(Model self, PidRepository rep, Samples samples, int start_stage, int end_stage) int
apply_feature_processors(Model self, Features features, bool learning) int[source]
asSerializable(Model self) SerializableObject[source]
calc_contribs(Model self, Mat mat, Mat mat_out)[source]
calc_feature_contribs_conditional(Model self, Mat mat_x_in, string const & features_cond_string, float features_cond_float, Mat mat_x_out, Mat mat_contribs)[source]
clear(Model self)[source]
collect_and_add_virtual_signals(Model self, PidRepository rep) int[source]
dprint_process(Model self, string const & pref, int rp_flag, int fg_flag, int fp_flag, bool pp_flag, bool predictor_type)[source]
property features

MEDPY_GET_features(Model self) -> Features

filter_rep_processors(Model self)[source]
fit_for_repository(Model self, PidRepository rep)[source]
generate_all_features(Model self, PidRepository rep, Samples samples, Features features, StringVector req_feature_generators) int[source]
get_all_features_names(Model self, StringVector feat_names, int before_process_set)[source]
get_required_signal_names(Model self) StringVector[source]
init_from_json_file(Model self, std: :string const & fname)[source]
init_from_json_file_with_alterations(Model self, std: :string const & fname, StringVector json_alt) StringVector[source]
learn(Model self, PidRepository rep, Samples samples) int[source]
learn(Model self, PidRepository rep, Samples samples, int start_stage, int end_stage) int
learn_and_apply_feature_processors(Model self, Features features) int[source]
learn_feature_generators(Model self, PidRepository rep, Samples learn_samples) int[source]
learn_feature_processors(Model self, Features features) int[source]
learn_rep_processors(Model self, PidRepository rep, Samples samples) int[source]
make_predictor(Model self, string name)[source]
quick_learn_rep_processors(Model self, PidRepository rep, Samples samples) int[source]
read_from_file(Model self, string const & fname) int[source]
set_predictor(Model self, Predictor _predictor)[source]
set_predictor(Model self, string name, string init_string)
property thisown

The membership flag

property verbosity

MEDPY_GET_verbosity(Model self) -> int

write_feature_matrix(Model self, string const mat_fname) int[source]
write_to_file(Model self, std: :string const & fname) int[source]
class med.ModelStage(ModelStage self) ModelStage[source]

Bases: object

Proxy of C++ MPModelStage class.

property thisown

The membership flag

class med.PidRepository(PidRepository self) PidRepository[source]

Bases: object

Proxy of C++ MPPidRepository class.

MEDPY_GET_pids(PidRepository self) IntVector[source]
clear()[source]
load_from_json()

Clear repository memory. erase in-memory patient data

property dict

MPDictionary

Type:

dict

dict_name(int_section_id, int_id) string[source]

returns name of section + id

dict_prep_sets_lookup_table(int_section_id, list_String set_names) BoolVector[source]

returns a look-up-table for given set names

dict_section_id(str_secName) int[source]

returns section id number for a given section name

export_to_numpy(str_signame) SigExporter[source]

Returns the signal data represented as a list of numpy arrays, one for each field

finish_load_data()[source]

prepare for model apply. not need to call it specifically.

free(signame) int[source]

Free the signal data specified by signame

get_lut_from_regex(section_id, regex_s)[source]
get get_lut_from_regex to names -> BoolVector

returns a lut - boolean vector

get_sig(signame [, translate=True][, pids=None, float32to64=True][,regex_str = None]) Pandas DataFrame[source]

translate : If True, will decode categorical fields into a readable representation in Pandas pid : If list is provided, will load only pids from the given list

If ‘All’ is provided, will use all available pids

float32to64 : If True, will convert all float32 columns to float64 free_signal : If True, will free signal memory as soon as it is loaded into export arrays regex_str : string (if string, defualt column is ‘val’) or dictionary between column name (e.g, ‘val’) to regex string to filter regex_filter : string to filter categories paretns this match regex

Parameters:
  • sig_name_str (str)

  • translate (bool)

  • pids (list[int] | str | None)

  • float32to64 (bool)

  • free_signal (bool)

  • regex_str (str | None)

  • regex_filter (str)

Return type:

pd.DataFrame

init(conf_file_name) int[source]

returns -1 if fails

is_categorical(str_signame, int_val_channel) bool[source]

returns True is channel is categorical

list_signals(PidRepository self) StringVector[source]
load_from_json(json_file_path)[source]

Loads patient data into in-mem repository. If patient exists, adds more data

load_from_json_str(json_string)[source]

Loads patient data into in-mem repository. If patient exists, adds more data

loadsig(str_signame) int[source]

load a signal

loadsig_pids(PidRepository self, std: :string const & signame, int * pids_to_take) int[source]
property pids

MEDPY_GET_pids(PidRepository self) -> IntVector

read_all(conf_file_fname[, pids_to_take_array][, list_str_signals_to_take]) int[source]

returns -1 if fails reading a repository for a group of pids and signals.Empty group means all of it.read_all(conf_file_fname, [pids_to_take_array], [list_str_signals_to_take]) -> int returns -1 if fails reading a repository for a group of pids and signals.Empty group means all of it.

read_all_i(PidRepository self, std: :string const & conf_fname, IntVector pids_to_take, IntVector signals_to_take) int[source]
sig_description(str_signame) string[source]

returns signal string description

sig_id(str_signame) int[source]

returns signal id number for a given signal name

sig_type(str_signame) int[source]

returns signal type

switch_to_in_mem()[source]

Switch to in mem repository mode

property thisown

The membership flag

uget(int_pid, int_sid) SigVectorAdaptor[source]

returns a vector of universal signals

class med.Predictor(Predictor self) Predictor[source]
class med.Predictor(Predictor self, string model_type, string params="") Predictor

Bases: object

Proxy of C++ MPPredictor class.

MEDPY_GET_features_count(Predictor self) int[source]
MEDPY_GET_model_features(Predictor self) StringVector[source]
MEDPY_GET_normalize_for_learn(Predictor self) bool[source]
MEDPY_GET_normalize_for_predict(Predictor self) bool[source]
MEDPY_GET_normalize_y_for_learn(Predictor self) bool[source]
MEDPY_GET_transpose_for_learn(Predictor self) bool[source]
MEDPY_GET_transpose_for_predict(Predictor self) bool[source]
MEDPY_SET_features_count(Predictor self, int new_val)[source]
MEDPY_SET_model_features(Predictor self, StringVector new_val)[source]
MEDPY_SET_normalize_for_learn(Predictor self, bool new_val)[source]
MEDPY_SET_normalize_for_predict(Predictor self, bool new_val)[source]
MEDPY_SET_normalize_y_for_learn(Predictor self, bool new_val)[source]
MEDPY_SET_transpose_for_learn(Predictor self, bool new_val)[source]
MEDPY_SET_transpose_for_predict(Predictor self, bool new_val)[source]
asSerializable(Predictor self) SerializableObject[source]
property features_count

MEDPY_GET_features_count(Predictor self) -> int

learn(Predictor self, Features features) int[source]
static make_predictor(string model_type) Predictor[source]
static make_predictor(string model_type, string params) Predictor
property model_features

MEDPY_GET_model_features(Predictor self) -> StringVector

property normalize_for_learn

MEDPY_GET_normalize_for_learn(Predictor self) -> bool

property normalize_for_predict

MEDPY_GET_normalize_for_predict(Predictor self) -> bool

property normalize_y_for_learn

MEDPY_GET_normalize_y_for_learn(Predictor self) -> bool

predict(Predictor self, Features features) int[source]
property thisown

The membership flag

property transpose_for_learn

MEDPY_GET_transpose_for_learn(Predictor self) -> bool

property transpose_for_predict

MEDPY_GET_transpose_for_predict(Predictor self) -> bool

write_predictor_to_file(Predictor self, string & outFile)[source]
class med.PredictorTypes(PredictorTypes self) PredictorTypes[source]

Bases: object

Proxy of C++ MPPredictorTypes class.

property thisown

The membership flag

class med.Sample(Sample self) Sample[source]

Bases: object

Proxy of C++ MPSample class.

MEDPY_GET_id(Sample self) int[source]
MEDPY_GET_outcome(Sample self) int[source]
MEDPY_GET_outcomeTime(Sample self) int[source]
MEDPY_GET_prediction(Sample self)[source]
MEDPY_GET_split(Sample self) int[source]
MEDPY_GET_time(Sample self) int[source]
MEDPY_SET_id(Sample self, int new_id)[source]
MEDPY_SET_outcome(Sample self, int new_outcome)[source]
MEDPY_SET_outcomeTime(Sample self, int new_outcome_time)[source]
MEDPY_SET_prediction(Sample self, float * in_predbuf)[source]
MEDPY_SET_split(Sample self, int new_sp)[source]
MEDPY_SET_time(Sample self, int new_time)[source]
asSerializable(Sample self) SerializableObject[source]
property id

MEDPY_GET_id(Sample self) -> int

property outcome

MEDPY_GET_outcome(Sample self) -> int

property outcomeTime

MEDPY_GET_outcomeTime(Sample self) -> int

parse_from_string(Sample self, string & s, int time_unit) int[source]
property prediction

MEDPY_GET_prediction(Sample self)

print_(Sample self, string const prefix)[source]
print_(Sample self)
property split

MEDPY_GET_split(Sample self) -> int

property thisown

The membership flag

property time

MEDPY_GET_time(Sample self) -> int

write_to_string(Sample self, string & s, int time_unit)[source]
class med.SampleFilter(SampleFilter self) SampleFilter[source]

Bases: object

Proxy of C++ MPSampleFilter class.

asSerializable(SampleFilter self) SerializableObject[source]
filter(rep, samples) int[source]

in-place filtering with repository. returns -1 if fails.

static from_name(string name) SampleFilter[source]
static from_name_params(string name, string params) SampleFilter[source]
static from_type(int type) SampleFilter[source]
static from_type_params(int type, string params) SampleFilter[source]
property thisown

The membership flag

class med.SampleVectorAdaptor(SampleVectorAdaptor self) SampleVectorAdaptor[source]

Bases: object

Proxy of C++ MPSampleVectorAdaptor class.

append(SampleVectorAdaptor self, Sample val)[source]
append_vec(SampleVectorAdaptor self, SampleVectorAdaptor other)[source]
nSplits(SampleVectorAdaptor self) int[source]
override_splits(SampleVectorAdaptor self, int nfolds)[source]
property thisown

The membership flag

class med.Samples(Samples self) Samples[source]

Bases: object

Proxy of C++ MPSamples class.

MEDPY_GET_idSamples(Samples self) IdSamplesVectorAdaptor[source]
MEDPY_GET_time_unit(Samples self) int[source]
MEDPY_SET_time_unit(Samples self, int new_time_unit)[source]
MEDPY__from_df(Samples self, PandasAdaptor pandas_df)[source]
MEDPY__from_df_adaptor(Samples self) PandasAdaptor[source]
MEDPY__to_df(Samples self) PandasAdaptor[source]
append(Samples self, Samples newSamples)[source]
asSerializable(Samples self) SerializableObject[source]
clear(Samples self)[source]
dilute(Samples self, float prob)[source]
export_to_sample_vec(Samples self) SampleVectorAdaptor[source]
get_attributes(Samples self) StringVector[source]
get_categs(Samples self)[source]
get_ids(Samples self)[source]
get_predictions_size(Samples self) int[source]
get_preds(Samples self)[source]
get_str_attributes(Samples self) StringVector[source]
get_y(Samples self)[source]
property idSamples

MEDPY_GET_idSamples(Samples self) -> IdSamplesVectorAdaptor

import_from_sample_vec(Samples self, SampleVectorAdaptor vec_samples, bool allow_split_inconsistency=False)[source]
insertRec(Samples self, int pid, int time, float outcome, int outcomeTime)[source]
insertRec(Samples self, int pid, int time, float outcome, int outcomeTime, float pred)
insertRec(Samples self, int pid, int time)
insert_preds(Samples self, Features featuresData) int[source]
nSamples(Samples self) int[source]
nSplits() int[source]

Return number of splits, also check mismatches between idSample and internal MedSamples and set idSamples.split if missing

normalize(Samples self)[source]
override_splits(Samples self, int nfolds)[source]
read_from_bin_file(Samples self, string const & file_name) int[source]
read_from_file(Samples self, string const & file_name) int[source]
same_as(Samples self, Samples other, int mode) bool[source]
set_samples(Samples self, int * patients, int _time=-1)[source]
sort_by_id_date(Samples self)[source]
split_train_test(Samples self, Samples train, Samples test, float p_test)[source]
subtract(Samples self, Samples _dont_use)[source]
property thisown

The membership flag

property time_unit

MEDPY_GET_time_unit(Samples self) -> int

version(Samples self) int[source]
write_to_bin_file(Samples self, string const & file_name) int[source]
write_to_file(Samples self, string const & fname) int[source]
class med.Sig(Sig self, Sig other) Sig[source]

Bases: object

Proxy of C++ MPSig class.

date(Sig self, int chan=0) int[source]
days(Sig self, int chan=0) int[source]
hours(Sig self, int chan=0) int[source]
minutes(Sig self, int chan=0) int[source]
months(Sig self, int chan=0) int[source]
property thisown

The membership flag

time(Sig self, int chan=0) int[source]
timeU(Sig self, int to_time_unit) int[source]
val(Sig self, int chan=0) float[source]
years(Sig self, int chan=0) int[source]
class med.Split(Split self) Split[source]

Bases: object

Proxy of C++ MPSplit class.

MEDPY_GET_nsplits(Split self) int[source]
MEDPY_GET_pid2split(Split self) IntIntMapAdaptor[source]
clear(Split self)[source]
property nsplits

MEDPY_GET_nsplits(Split self) -> int

property pid2split

MEDPY_GET_pid2split(Split self) -> IntIntMapAdaptor

read_from_file(Split self, string const & fname) int[source]
property thisown

The membership flag

write_to_file(Split self, string const & fname) int[source]
class med.Time(Time self) Time[source]

Bases: object

Proxy of C++ MPTime class.

property thisown

The membership flag

med.logger_use_stdout()[source]