def extract_basic_feats_n_heads(series, modality, field, stat_type, trans_type): """ feature extraction with given time series data :return: feature name list, feature value list """ heads = [] + stat_type sig_heads = [] for sig_feat in feat.SIGNAL_FEATS: if sig_feat in stat_type: heads.remove(sig_feat) sig_heads += [sig_feat] stats = map(lambda x: comp.compute_basic_stat(series, x), heads) stats += comp.compute_peak_stats(series) if feat.AVG_PEAK_INTERVAL in sig_heads else [] stats += comp.compute_fft_stats(series) if feat.FT_REL_FREQ_1ST in sig_heads else [] heads += sig_heads if trans_type in feat.BIN_NEEDED_TR_TYPES: eq_freq = True if feat.DISC_FQ in trans_type else False bin_heads, bin_stats = extract_bin_feats_and_heads(series, modality, field, eq_freq) heads += bin_heads stats += bin_stats return heads, stats
def get_feature_list(df_raw, c_name): return [compute_basic_stat(df_raw[c_name], f) for f in STATISTICS]