Example #1
0
def cla_filter():
    aux = []
    resul1 = [[], [], [], [], [], [], []]
    resul2 = [[], [], [], [], [], [], []]
    resul3 = [[], [], [], [], [], [], []]
    resul4 = [[], [], [], [], [], [], []]
    resul5 = [[], [], [], [], [], [], []]
    resul6 = [[], [], [], [], [], [], []]
    resul7 = [[], [], [], [], [], [], []]
    resul8 = [[], [], [], [], [], [], []]
    resul9 = [[], [], [], [], [], [], []]
    roc_m_1 = [[], [], [], [], [], [], []]
    roc_m_2 = [[], [], [], [], [], [], []]
    roc_m_3 = [[], [], [], [], [], [], []]
    roc_m_4 = [[], [], [], [], [], [], []]
    roc_m_5 = [[], [], [], [], [], [], []]
    roc_m_6 = [[], [], [], [], [], [], []]
    roc_m_7 = [[], [], [], [], [], [], []]
    roc_m_8 = [[], [], [], [], [], [], []]
    roc_m_9 = [[], [], [], [], [], [], []]
    SMILaMax = [simpleMIL(), {'type': 'max'}, 'MIL max', resul1, roc_m_1]
    SMILaMin = [simpleMIL(), {'type': 'min'}, 'MIL min', resul2, roc_m_2]
    SMILaExt = [
        simpleMIL(), {
            'type': 'extreme'
        }, 'MIL Extreme', resul3, roc_m_3
    ]
    BOW_clas = [
        BOW(), {
            'k': 90,
            'covar_type': 'diag',
            'n_iter': 20
        }, 'BOW', resul4, roc_m_4
    ]
    CKNN_cla = [
        CKNN(), {
            'references': 3,
            'citers': 5
        }, 'CKNN', resul5, roc_m_5
    ]
    maxDD_cl = [maxDD(), {}, 'DIVERSE DENSITY', resul6, roc_m_6]
    EMDD_cla = [EMDD(), {}, 'EM-DD', resul7, roc_m_7]
    MILB_cla = [MILBoost(), {}, 'MILBOOST', resul8, roc_m_8]
    MILES_cl = [MILES(), {}, 'MILES', resul9, roc_m_9]
    aux.append(SMILaMax)
    #    aux.append(SMILaMin)
    #    aux.append(SMILaExt)
    aux.append(BOW_clas)
    #    aux.append(CKNN_cla)
    aux.append(maxDD_cl)
    #    aux.append(EMDD_cla)
    #    aux.append(MILB_cla)
    #    aux.append(MILES_cl)
    return aux
Example #2
0
def cla_filter_ipf():
    aux = []
    resul1 = [[],[],[],[],[],[],[]]
    roc_m_1 = [[],[],[],[],[],[],[]]
    SMILaMax = [simpleMIL(),{'type': 'max'},'MIL max',copy.deepcopy(resul1),copy.deepcopy(roc_m_1)]
    SMILaMin = [simpleMIL(),{'type': 'min'},'MIL min',copy.deepcopy(resul1),copy.deepcopy(roc_m_1)]
    SMILaExt = [simpleMIL(),{'type': 'extreme'},'MIL Extreme',copy.deepcopy(resul1),copy.deepcopy(roc_m_1)]
    BOW_clas = [BOW(),{'k':90,'covar_type':'diag','n_iter':20},'BOW',copy.deepcopy(resul1),copy.deepcopy(roc_m_1)]
    CKNN_cla = [CKNN(),{'references': 3, 'citers': 5},'CKNN',copy.deepcopy(resul1),copy.deepcopy(roc_m_1)]
    maxDD_cl = [maxDD(),{},'DIVERSE DENSITY',copy.deepcopy(resul1),copy.deepcopy(roc_m_1)]
    EMDD_cla = [EMDD(),{},'EM-DD',copy.deepcopy(resul1),copy.deepcopy(roc_m_1)]
    MILB_cla = [MILBoost(),{},'MILBOOST',copy.deepcopy(resul1),copy.deepcopy(roc_m_1)]
#    MILES_cl = [MILES(),{},'MILES',copy.deepcopy(resul1),copy.deepcopy(roc_m_1)]
    aux.append(SMILaMax)
    aux.append(SMILaMin)
    aux.append(SMILaExt)
    aux.append(BOW_clas)
    aux.append(CKNN_cla)
    aux.append(maxDD_cl)
    aux.append(EMDD_cla)
    aux.append(MILB_cla)
#    aux.append(MILES_cl)
    return aux
Example #3
0
    bags=bags,
    labels=labels,
    model=SMILa,
    folds=folds,
    parameters=parameters_smil)

parameters_smil = {'type': 'average'}
#En este me funciono maxDD porque no tiene problem con parametros
accuracie, results_accuracie, auc, results_auc = mil_cross_val(
    bags=bags,
    labels=labels,
    model=SMILa,
    folds=folds,
    parameters=parameters_smil)

cknn_classifier = CKNN()
parameters_cknn = {'references': 3, 'citers': 5}
accuracie, results_accuracie, auc, results_auc = mil_cross_val(
    bags=bags,
    labels=labels,
    model=cknn_classifier,
    folds=folds,
    parameters=parameters_cknn)

maxDD_classifier = maxDD()
accuracie, results_accuracie, auc, results_auc = mil_cross_val(
    bags=bags,
    labels=labels,
    model=maxDD_classifier,
    folds=folds,
    parameters={})
Example #4
0
#simpleMIL [min]#
#################
SMILmn = simpleMIL()
SMILmn.fit(train_bags, train_labels, type='min')
predictions = SMILmn.predict(test_bags)
accuracie = np.average(test_labels.T == np.sign(predictions))
print '\n Accuracy: %.2f%%' % (100 * accuracie)
fpr, tpr, thresholds = metrics.roc_curve(test_labels,
                                         predictions,
                                         pos_label=1.)
metrics.auc(fpr, tpr)

#####
#CNN#
#####
cknn_classifier = CKNN()
cknn_classifier.fit(train_bags, train_labels, references=3, citers=5)
predictions = cknn_classifier.predict(test_bags)
accuracie = np.average(test_labels.T == np.sign(predictions))
print '\n Accuracy: %.2f%%' % (100 * accuracie)
fpr, tpr, thresholds = metrics.roc_curve(test_labels,
                                         predictions,
                                         pos_label=1.)
metrics.auc(fpr, tpr)

#######
#MAXDD#
#######
maxdd_classifier = maxDD()
maxdd_classifier.fit(train_bags=train_bags,
                     train_labels=train_labels)  #Train Classifier