You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.5 KiB
65 lines
2.5 KiB
from models import *
|
|
from analise import *
|
|
|
|
def report(accuracy,confMatrix,classReport):
|
|
print(f'Accuracy: {accuracy}')
|
|
print(f'Confusion Matrix:\n{confMatrix}')
|
|
print(f'Classification Report:\n{classReport}')
|
|
|
|
|
|
def startRandomForest(X_train,X_test,y_train,y_test):
|
|
y_pred, rf = RandomForest(X_train, X_test, y_train)
|
|
rf_ac, rf_matrix, rf_class_report = calculateMatrix(y_test, y_pred)
|
|
report(rf_ac, rf_matrix, rf_class_report)
|
|
seeMatrix(rf_matrix, rf.classes_)
|
|
#rocCurve(y_test, y_pred)
|
|
#seeRocCurve(rf, X_train, y_train, 10)
|
|
|
|
def startKNN(X_train,X_test,y_train,y_test):
|
|
y_pred, knn = KNN(X_train, X_test, y_train)
|
|
knn_ac, knn_matrix, knn_class_report = calculateMatrix(y_test, y_pred)
|
|
report(knn_ac, knn_matrix, knn_class_report)
|
|
seeMatrix(knn_matrix, knn.classes_)
|
|
#rocCurve(y_test, y_pred)
|
|
#seeRocCurve(rf, X_train, y_train, 10)
|
|
|
|
def startSVM(X_train,X_test,y_train,y_test):
|
|
y_pred, svm = SVM(X_train, X_test, y_train)
|
|
svm_ac, svm_matrix, svm_class_report = calculateMatrix(y_test, y_pred)
|
|
report(svm_ac, svm_matrix, svm_class_report)
|
|
seeMatrix(svm_matrix, svm.classes_)
|
|
#rocCurve(y_test, y_pred)
|
|
#seeRocCurve(rf, X_train, y_train, 10)
|
|
|
|
def startDecisionTree(X_train,X_test,y_train,y_test):
|
|
y_pred, dt = DecisionTree(X_train, X_test, y_train)
|
|
dt_ac, dt_matrix, dt_class_report = calculateMatrix(y_test, y_pred)
|
|
report(dt_ac, dt_matrix, dt_class_report)
|
|
seeMatrix(dt_matrix, dt.classes_)
|
|
#rocCurve(y_test, y_pred)
|
|
#seeRocCurve(rf, X_train, y_train, 10)
|
|
|
|
def startLogisticRegression(X_train,X_test,y_train,y_test):
|
|
y_pred, lr = LogisticRegress(X_train, X_test, y_train)
|
|
lr_ac, lr_matrix, lr_class_report = calculateMatrix(y_test, y_pred)
|
|
report(lr_ac, lr_matrix, lr_class_report)
|
|
seeMatrix(lr_matrix, lr.classes_)
|
|
#rocCurve(y_test, y_pred)
|
|
#seeRocCurve(rf, X_train, y_train, 10)
|
|
|
|
def startLinearSVC(X_train,X_test,y_train,y_test):
|
|
y_pred, svc = Linearsvc(X_train, X_test, y_train)
|
|
svc_ac, svc_matrix, svc_class_report = calculateMatrix(y_test, y_pred)
|
|
report(svc_ac, svc_matrix, svc_class_report)
|
|
seeMatrix(svc_matrix, svc.classes_)
|
|
#rocCurve(y_test, y_pred)
|
|
#seeRocCurve(rf, X_train, y_train, 10)
|
|
|
|
def startNaiveBayes(X_train,X_test,y_train,y_test):
|
|
y_pred, gnb = GaussianNaiveBayes(X_train, X_test, y_train)
|
|
gnb_ac, gnb_matrix, gnb_class_report = calculateMatrix(y_test, y_pred)
|
|
report(gnb_ac, gnb_matrix, gnb_class_report)
|
|
seeMatrix(gnb_matrix, gnb.classes_)
|
|
#rocCurve(y_test, y_pred)
|
|
#seeRocCurve(rf, X_train, y_train, 10)
|