def combtn_fun(self): dataset = ["50-50", "70-30", "80-20"] svm = [] bp = [] gsa = [] plot = [] x = [50, 70, 80] for i in dataset: acc1, sens1, cm1 = svm_breastdev.predict(dataset=i) acc2, sens2, cm2 = bp_breastdev.predict(dataset=i) acc, fet_sub = gsadev.predict(dataset=i) svm.append(acc1) bp.append(acc2) gsa.append(acc) plt.plot(x, svm, label="SVM") plt.plot(x, bp, label="BP") plt.plot(x, gsa, label="GSA") plt.xlabel("Training Set (%)") plt.ylabel("Accuracy") plt.title("Algorithm Comparision") plt.legend() plt.legend(bbox_to_anchor=(1.05, 1), loc=1, borderaxespad=0.) plt.show()
def combtn1_fun(self): ker = ["rbf", "poly", "sigmoid"] dataset = ["50-50", "70-30", "80-20"] C = str(self.le_c.text()) gamma = str(self.le_gamma.text()) c_float = eval(C) gamma_float = eval(gamma) plot = [] x = [50, 70, 80] for i in ker: v = [] for j in dataset: acc, sens, cm = svm_breastdev.predict(i, j, c_float, gamma_float) v.append(acc) plot.append(v) a = 0 #print plot for i in plot: plt.plot(x, i, label=ker[a]) a += 1 plt.xlabel("Training Set (%)") plt.ylabel("Accuracy") plt.title("Kernel Comparision") plt.legend() plt.legend(bbox_to_anchor=(1.05, 1), loc=1, borderaxespad=0.) plt.show()
def crbtn1_fun(self): kernel = str(self.cb1.currentText()) print "kernel ", kernel dataset = str(self.cb2.currentText()) print "dataset ", dataset C = str(self.le_c.text()) print "C ", C gamma = str(self.le_gamma.text()) print "gamma ", gamma c_float = eval(C) gamma_float = eval(gamma) print c_float, gamma_float acc, sens, cm = svm_breastdev.predict(kernel, dataset, c_float, gamma_float) self.res1.append("Confusion Matrix:") self.res1.append("\t\tBenign\tMalignant") self.res1.append("Benign\t\t" + str(cm[0][0]) + "\t" + str(cm[0][1])) self.res1.append("Malignant\t\t" + str(cm[1][0]) + "\t" + str(cm[1][1])) self.res1.append("\nAccuracy : " + str(round(acc * 100, 2)) + "%") self.res1.append("\nSenstivity :\n" + "Benign: " + str(round(sens[0] * 100, 2)) + "%") self.res1.append("Malignant: " + str(round(sens[1] * 100, 2)) + "%\n") plot.predict(kernel, dataset, c_float, gamma_float)