ts = ret["t"] train_y = ret["y"] train_names = ret["name"] diseases_list = get_diseases(train_names, f'{data_dir}/') diseases_embedding = disease_embedding(embeddings, word_indices, diseases_list) d, discretizer_header, begin_pos, end_pos = discretizer.transform_reg(data[0]) discretizer_header = discretizer_header.split(',') cont_channels = [ i for (i, x) in enumerate(discretizer_header) if x.find("->") == -1 ] da = [ discretizer.transform_end_t_hours_reg(X, los=t)[1] for (X, t) in zip(data, ts) ] mask = [column_sum(x) for x in da] #train_set=[] d = [ discretizer.transform_end_t_hours_reg(X, los=t)[0] for (X, t) in zip(data, ts) ] idx_features_train = [ logit(X, cont_channels, begin_pos, end_pos)[0] for X in d ] features_train = [logit(X, cont_channels, begin_pos, end_pos)[1] for X in d]
train_y = ret["y"] train_names = ret["name"] diseases_list = get_diseases(train_names, dataset_subject_dir) diseases_embedding = disease_embedding(embeddings, word_indices, diseases_list) feature_cols = ['LOS', 'Hos_LOS', 'Num_Prev_Hos_Adm'] additional_features = get_additional_features(train_names) # additional_features_list = normalize_standard(additional_features, feature_cols).values.tolist() d, discretizer_header, begin_pos, end_pos = discretizer.transform_reg(data[0]) discretizer_header = discretizer_header.split(',') cont_channels = [i for (i, x) in enumerate(discretizer_header) if x.find("->") == -1] da = [discretizer.transform_end_t_hours_reg(X, los=t)[1] for (X, t) in zip(data, ts)] mask = [column_sum(x) for x in da] # train_set=[] d = [discretizer.transform_end_t_hours_reg(X, los=t)[0] for (X, t) in zip(data, ts)] idx_features_train = [logit(X, cont_channels, begin_pos, end_pos)[0] for X in d] features_train = [logit(X, cont_channels, begin_pos, end_pos)[1] for X in d] features_train_extended = [np.hstack([X, d]) for (X, d) in zip(features_train, additional_features.values.tolist())] train_X = features_train_extended scaler = MinMaxScaler() scaler.fit(train_X) train_X = scaler.transform(train_X)