11"""
2- ===================================================
3- Feature selection performance on redundant features
4- ===================================================
2+ =================================
3+ Performance on redundant features
4+ =================================
55
66.. currentmodule:: fastcan
77
@@ -109,8 +109,7 @@ def get_n_missed(
109109 n_missed_dep = len (
110110 np .setdiff1d (dep_info_ids + redundant_ids , selected_ids )
111111 )- n_redundant
112- if n_missed_dep < 0 :
113- n_missed_dep = 0
112+ n_missed_dep = max (n_missed_dep , 0 )
114113 return n_missed_indep + n_missed_dep
115114
116115# %%
@@ -160,7 +159,7 @@ def get_n_missed(
160159N_REPEATED = 10
161160
162161selector_dict = {
163- "fastcan" : FastCan (N_SELECTED , verbose = 0 ),
162+ "fastcan" : FastCan (N_SELECTED , tol = 1e-7 , verbose = 0 ),
164163 "skb_reg" : SelectKBest (f_regression , k = N_SELECTED ),
165164 "skb_mir" : SelectKBest (mutual_info_regression , k = N_SELECTED ),
166165 "sfm_lsvr" : SelectFromModel (lsvr , max_features = N_SELECTED , threshold = - np .inf ),
@@ -179,7 +178,7 @@ def get_n_missed(
179178n_missed = np .zeros ((N_REPEATED , N_SELECTORS ), dtype = int )
180179
181180for i in range (N_REPEATED ):
182- X , y = make_redundant (
181+ data , target = make_redundant (
183182 n_samples = N_SAMPLES ,
184183 n_features = N_FEATURES ,
185184 dep_info_ids = DEP_INFO_IDS ,
@@ -188,7 +187,7 @@ def get_n_missed(
188187 random_seed = i ,
189188 )
190189 for j , selector in enumerate (selector_dict .values ()):
191- result_ids = selector .fit (X , y ).get_support (indices = True )
190+ result_ids = selector .fit (data , target ).get_support (indices = True )
192191 n_missed [i , j ] = get_n_missed (
193192 dep_info_ids = DEP_INFO_IDS ,
194193 indep_info_ids = INDEP_INFO_IDS ,
0 commit comments