models/feature_selection_methods.py
def anova_fs(X_df,X_train_all,X_test_all,y_train,p_val_thresh):
    '''ANOVA F statistical test for feature selection'''
    f,p = f_classif(X_train_all,y_train)
    feature_ids = np.where(p<=p_val_thresh)[0]


    selected_features = np.array(X_df.columns[feature_ids])

    #New X_train and X_test matrices
    X_train = X_train_all[:,feature_ids]
    X_test = X_test_all[:,feature_ids]

    X_train_df = pd.DataFrame(X_train,columns=selected_features)

    return selected_features, X_train_df, X_train, X_test
ANOVA F statistical test for feature selection
ANOVA F statistical test for feature selection
ANOVA F statistical test for feature selection
def anova_fs(X_df,X_train_all,X_test_all,y_train,p_val_thresh):
    f,p = f_classif(X_train_all,y_train)
    feature_ids = np.where(p<=p_val_thresh)[0]
    selected_features = np.array(X_df.columns[feature_ids])
    X_train = X_train_all[:,feature_ids]
    X_test = X_test_all[:,feature_ids]
    X_train_df = pd.DataFrame(X_train,columns=selected_features)
    return selected_features, X_train_df, X_train, X_test
def anova_fs ( X_df , X_train_all , X_test_all , y_train , p_val_thresh ) : f , p = f_classif ( X_train_all , y_train ) feature_ids = np . where ( p <= p_val_thresh ) [ 0 ] selected_features = np . array ( X_df . columns [ feature_ids ] ) X_train = X_train_all [ : , feature_ids ] X_test = X_test_all [ : , feature_ids ] X_train_df = pd . DataFrame ( X_train , columns = selected_features ) return selected_features , X_train_df , X_train , X_test
ANOVA F statistical test for feature selection
ANOVA F statistical test for feature selection
'''ANOVA F statistical test for feature selection''' #New X_train and X_test matrices
X_df
X_train_all
X_test_all
y_train
p_val_thresh