def SelectSubSetmRMR(vectors, classes): X = vectors y = classes # define MI_FS feature selection method feat_selector = mifs.MutualInformationFeatureSelector() # find all relevant features feat_selector.fit(X, y) # check selected features feat_selector.support_ # check ranking of features return feat_selector.ranking_
def SelectSubSetmRMR(vectors, classes, useMethod='MRMR'):#, numOfFeatures=500): X = vectors y = classes # define MI_FS feature selection method feat_selector = mifs.MutualInformationFeatureSelector(method=useMethod) #n_features=numOfFeatures) # find all relevant features feat_selector.fit(X, y) # check selected features feat_selector.support_ # check ranking of features return feat_selector.ranking_
def SelectSubSetmRMR(vectors, classes,useMethod,features): X = vectors y = classes # define MI_FS feature selection method feat_selector = mifs.MutualInformationFeatureSelector(method=useMethod,n_features=features) # find all relevant features feat_selector.fit(X, y) # check selected features print (feat_selector.support_) # check ranking of features print (feat_selector.ranking_) print (len(feat_selector.ranking_)) selected_indices=feat_selector.ranking_ # call transform() on X to filter it down to selected features X_filtered = feat_selector.transform(X) return [X_filtered,selected_indices]