import operator
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.preprocessing import StandardScaler
import time
from Accuracy import Accuracy
from getXY import getXY, getXY_single
import sys
from sklearn.model_selection import train_test_split
from pprint import pprint as pp

X, y = getXY(sys.argv[1])

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)


from Models.Logistic import Load

# start_time = time.time()
modelLR = Load()
# print("Time Taken to Train: {}".format(time.time() - start_time))

y_pred = modelLR.predict(X_test)
acc,con=Accuracy(y_test, y_pred)

print('Logistic Reg Accuracy: {}'.format(acc))
pp(con)
print()
### ---------------- Random Forest ---------------------- ###

from Models.RandomForest import Load as RLoad

# start_time = time.time()
modelRF = RLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))

y_pred = modelRF.predict(X_test)

acc,con = Accuracy(y_test, y_pred)
print('Random Forest Accuracy: {}'.format(acc))
pp(con)
print()
### ------------------------ SVM --------------------------- ###

from Models.SVM import Load as SVMLoad

# start_time = time.time()
modelSVM = SVMLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))

y_pred = modelSVM.predict(X_test)

acc,con=Accuracy(y_test, y_pred)
print('SVM with rbf Accuracy: {}'.format(acc))
print(con)
print()
### ---------------------- AdaBoost ------------------------- ###

from Models.AdaBoost import Load as AdaLoad

# start_time = time.time()
modelAda = AdaLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))

y_pred = modelAda.predict(X_test)

acc,con=Accuracy(y_test, y_pred)
print('AdaBoost Accuracy: {}'.format(acc))
print(con)
print()
### --------------------- Gradient Boosting ---------------- ###

from Models.GradientBoosting import Load as GBLoad

# start_time = time.time()
modelGB = GBLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))

y_pred = modelGB.predict(X_test)

acc,con=Accuracy(y_test, y_pred)
print('Gradient Boosting Accuracy: {}'.format(acc))
print(con)

### -------------------- XGBoost --------------------------- ###

from Models.XGBoost import Load as XGBLoad

# start_time = time.time()
modelXGB = XGBLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))

y_pred = modelXGB.predict(X_test)

acc,con=Accuracy(y_test, y_pred)
print('XGBoost Accuracy: {}'.format(acc))
print(con)

### --------------------- Decision Tree ------------------------ ###

from Models.DecisionTree import Load as DTLoad

# start_time = time.time()
modelDT = DTLoad()
# print("Time Taken to Train: {}".format(time.time() - start_time))

y_pred = modelDT.predict(X_test)

acc,con=Accuracy(y_test, y_pred)
print('Decision Tree Accuracy: {}'.format(acc))
print(con)