Ejemplo n.º 1
0
detection_rate = detection_rate / no

f.write("\n")
f.write("Detection rate of GradBoostDiabetes model is:\n")
f.write(str(detection_rate))
f.write("\n")

f.write("-----End of the execution GradBoostDiabetes-----")
f.write("\n")
f.write("\n")
print("GradBoostDiabetes finished")

#kNNCarEval model evaluation
detection_rate = 0
for i in tqdm(range(no)):
    detectionRate = kNNCarEval.func_main(MAX_SAMPLES)
    detection_rate = detection_rate + detectionRate

detection_rate = detection_rate / no

f.write("\n")
f.write("Detection rate of kNNCarEval model is:\n")
f.write(str(detection_rate))
f.write("\n")

f.write("-----End of the execution kNNCarEval-----")
f.write("\n")
f.write("\n")
print("kNNCarEval finished")

#NBMpg model evaluation
Ejemplo n.º 2
0
f.write("\n")
f.write("Failed attempts of kNNAutomobile model is:\n")
f.write(str(failed_trials))
f.write("\n")
f.write("-----End of the execution kNNAutomobile-----")
f.write("\n")
f.write("\n")

print("kNNAutomobile finished")

#kNNCarEval model evaluation
cexFlag = False
execTime = 0
failed_trials = 0
for i in tqdm(range(no)):
    cexPair, failed_att, execution_time = kNNCarEval.func_main(MAX_SAMPLES)
    execTime = execTime + execution_time
    failed_trials = failed_trials + failed_att

    if ((len(cexPair) >= 1) & (cexFlag == False)):
        f.write("\n")
        f.write("Counter example pair is:\n")
        f.write(str(cexPair))
        cexFlag = True
if (cexFlag == False):
    f.write("\n")
    f.write("No Counter example is found")
execTime = execTime / no
failed_trials = round(failed_trials / no)

f.write("\n")
f.write("Number of retrainings of kNNAutomobile model is:\n")
f.write(str(retrain_count))
f.write("\n")
f.write("-----End of the execution kNNAutomobile-----")
f.write("\n")
f.write("\n")
print("kNNAutomobile finished")


#kNNCarEval model evaluation
cexFlag = False
execTime = 0
failed_trials = 0
retrain_count = 0
for i in tqdm(range(no)):
    failed_att, no_retrain, execution_time, cexPair = kNNCarEval.func_main(MAX_SAMPLES)
    execTime = execTime + execution_time
    failed_trials = failed_trials+failed_att
    retrain_count = retrain_count+no_retrain
    
    if((len(cexPair) >= 1) &(cexFlag == False)):
        f.write("\n")
        f.write("Counter example pair is:\n")
        f.write(str(cexPair))
        cexFlag = True
if(cexFlag == False):
    f.write("\n")
    f.write("No Counter example is found:\n")		
    
execTime = execTime/no
failed_trials = round(failed_trials/no)