Exemple #1
0
def getProb(trainD, trainC, testD , lrn):
    orangeData = funkcije.listToOrangeSingleClass(trainD+testD, trainC+[0]*len(testD))
    ind = [1]*len(trainD)+[0]*len(testD)
    orangeTrainD = orangeData.select_ref(ind,1)
    orangeTestD = orangeData.select_ref(ind,0)

    cl = lrn(orangeTrainD)
    return [cl(i,  Orange.classification.Classifier.GetProbabilities)[True] for i in orangeTestD]
Exemple #2
0
def getProb(trainD, trainC, testD, lrn):
    orangeData = funkcije.listToOrangeSingleClass(trainD + testD,
                                                  trainC + [0] * len(testD))
    ind = [1] * len(trainD) + [0] * len(testD)
    orangeTrainD = orangeData.select_ref(ind, 1)
    orangeTestD = orangeData.select_ref(ind, 0)

    cl = lrn(orangeTrainD)
    return [
        cl(i, Orange.classification.Classifier.GetProbabilities)[True]
        for i in orangeTestD
    ]
Exemple #3
0
def reliefFilter(trainD, trainC):
    orangeData = funkcije.listToOrangeSingleClass(trainD, trainC)
    meas = Orange.feature.scoring.Relief()
    mr = [ (a.name, meas(a, orangeData)) for a in orangeData.domain.attributes]
    mr.sort(key=lambda x: -x[1]) #sort decreasingly by the score
    return [i[0] for i in mr]
Exemple #4
0
def reliefFilter(trainD, trainC):
    orangeData = funkcije.listToOrangeSingleClass(trainD, trainC)
    meas = Orange.feature.scoring.Relief()
    mr = [(a.name, meas(a, orangeData)) for a in orangeData.domain.attributes]
    mr.sort(key=lambda x: -x[1])  #sort decreasingly by the score
    return [i[0] for i in mr]