def test_multisurf_Multiplexer():
    """ Test MultiSURF on 6-bit Multiplexer """
    #New parameters
    options['algorithm'] = 'multisurf'
    Scores = MS.runMultiSURF(header, x, y, attr, var, distArray, options)
    print("MultiSURF + 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
示例#2
0
def test_multisurfstar_GWAS_Sim():
    """ Test MultiSURF* on GWAS_Sim """
    #New parameters
    options['algorithm'] = 'multisurfstar'
    Scores = MS.runMultiSURF(header, x, y, attr, var, distArray, options)
    print("MultiSURF* + GWAS_Sim  ")
    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
示例#3
0
def test_multisurf_GWAS_Sim():
    """ Test MultiSURF on GWAS_Sim Multiclass"""
    #New parameters
    options['algorithm'] = 'multisurf'
    Scores = MS.runMultiSURF(header, x, y, attr, var, distArray, options)
    print("MultiSURF + GWAS_Sim MC")
    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
def test_multisurf_Multiplexer():
    """ Test MultiSURF on 6-bit Multiplexer """
    #New parameters
    options['algorithm'] = 'multisurf'
    Scores = MS.runMultiSURF(header, x, y, attr, var, distArray, options)
    print("MultiSURF + 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