def test_relieff_Multiplexer(): """ Test ReliefF on 6-bit Multiplexer""" Scores = R.runReliefF(header, x, y, attr, var, distArray, options) print("ReliefF + 6-bit Multiplexer ") print(str(Scores)) #Check that score list is not empty assert Scores != None #Check that a score for all features is output assert len(Scores) == 6 #6-bit Multiplexer problem #Check that all scores fall between -1 and 1 assert max(Scores) <= 1 and min(Scores) >= -1 #Check that the address bits (indexed as features 0 and 1) have the top scores as expected. indexTopScore = Scores.index(max(Scores)) assert indexTopScore == 0 or indexTopScore == 1 Scores.pop(indexTopScore) indexTopScore = Scores.index(max(Scores)) assert indexTopScore == 0
def test_relieff_GWAS_Sim(): """ Test ReliefF on GWAS_Sim Missing Data """ Scores = R.runReliefF(header, x, y, attr, var, distArray, options) print("ReliefF + GWAS_Sim MD ") print(str(Scores)) #Check that score list is not empty assert Scores != None #Check that a score for all features is output assert len(Scores) == 20 #GWAS simulated dataset #Check that all scores fall between -1 and 1 assert max(Scores) <= 1 and min(Scores) >= -1 #Check that the address bits (indexed as features 0 and 1) have the top scores as expected. indexTopScore = Scores.index(max(Scores)) assert indexTopScore == 18 or indexTopScore == 19 Scores.pop(indexTopScore) indexTopScore = Scores.index(max(Scores)) assert indexTopScore == 18
import surf as S print('Running SURF or SURF* + TuRF') fun = S.runSURF if(algorithm == 'multisurf' or algorithm == 'multisurfstar'): import multisurf as MS print('Running MultiSURF or MultiSURF* + TuRF') fun = MS.runMultiSURF Scores,x,var,lost,table = T.runTurf(header,x,y,attr,var,distArray,pct,iterations,fun,options,cmn) options['algorithm'] = algorithm + "-turf" elif(algorithm == 'relieff'): import relieff as R print('Running Relieff') Scores = R.runReliefF(header,x,y,attr,var,distArray,options) elif(algorithm == 'surf' or algorithm =='surfstar'): import surf as S print('Running SURF or SURF*') Scores = S.runSURF(header, x, y, attr, var, distArray, options) elif(algorithm == 'multisurf' or algorithm == 'multisurfstar'): if(var['classType'] == 'multiclass'): import multisurf as MS print('Running MultiSURF or MultiSURF*') Scores = MS.runMultiSURF(header, x, y, attr, var, distArray, options) #-----------------------------------------------------------------------------# # create new data files of some number of top scored attributes ordered_attr = io.createScoresFile(header, var, Scores, options, prog_start, turfpct, table, lost)
if (var['classType'] == 'multiclass'): import mcms as MS else: import multisurf as MS fun = MS.runMultiSURF if (algorithm == 'surf' or algorithm == 'surfstar'): import surf as S fun = S.runSURF Scores,x,var,fullscores,lost,table = \ T.runTurf(header,x,y,attr,var,distArray,pct,iterations,fun,options) options['algorithm'] = algorithm + "-turf" elif (algorithm == 'relieff'): import relieff as R Scores = R.runReliefF(header, x, y, attr, var, distArray, options) elif (algorithm == 'multisurf'): if (var['classType'] == 'multiclass'): import mcms as MS else: import multisurf as MS Scores = MS.runMultiSURF(header, x, y, attr, var, distArray, options) elif (algorithm == 'surf' or algorithm == 'surfstar'): import surf as S Scores = S.runSURF(header, x, y, attr, var, distArray, options) #-----------------------------------------------------------------------------# # create new data files of some number of top scored attributes ordered_attr = io.createScoresFile(header, var, Scores, options, prog_start, turfpct, table, lost)