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.
48 lines
1.9 KiB
48 lines
1.9 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) |