from xgboost import XGBClassifier
from sklearn.metrics import classification_report, matthews_corrcoef

from sklearn import svm
from feature import Feature
from sklearn.linear_model import LogisticRegression

from sklearn.ensemble import VotingClassifier

import numpy as np


def init_data(file_name):
    seqs_blosum62, label, work2vec, seqs_sr, seqs_dde, seqs_z, seqs_aac, seqs_dpc, seqs_ctdd, seqs_ctrial, seqs_ksctriad, seqs_gtpc, seqs_cksaagp, seqs_gaac, seqs_gdpc, seqs_ctdt, seqs_geary, seqs_cksaap, seqs_aaindex, seqs_paac = Feature(
        file_name)
    seqs_sr = np.array(seqs_sr, dtype=np.float32)
    seqs_ksctriad = np.array(seqs_ksctriad, dtype=np.float32)
    work2vec = np.array(work2vec, dtype=np.float32)
    seqs_blosum62 = np.array(seqs_blosum62, dtype=np.float32)
    seqs_ctrial = np.array(seqs_ctrial, dtype=np.float32)
    seqs_gtpc = np.array(seqs_gtpc, dtype=np.float32)
    seqs_cksaagp = np.array(seqs_cksaagp, dtype=np.float32)
    seqs_gaac = np.array(seqs_gaac, dtype=np.float32)
    seqs_cksaap = np.array(seqs_cksaap, dtype=np.float32)
    seqs_aaindex = np.array(seqs_aaindex, dtype=np.float32)
    seqs_paac = np.array(seqs_paac, dtype=np.float32)
    seqs_gdpc = np.array(seqs_gdpc, dtype=np.float32)
    # print(seqs_gtpc.shape)
    seqs_ctdt = np.array(seqs_ctdt, dtype=np.float32)
    seqs_ctdt = seqs_ctdt.reshape(seqs_ctdt.shape[0], -1)
    seqs_dpc = np.array(seqs_dpc, dtype=np.float32)
    seqs_dpc = seqs_dpc.reshape(seqs_dpc.shape[0], -1)
    seqs_aac = np.array(seqs_aac, dtype=np.float32)
    seqs_aac = seqs_aac.reshape(seqs_aac.shape[0], -1)
    seqs_z = np.array(seqs_z, dtype=np.float32)
    seqs_z = seqs_z.reshape(seqs_z.shape[0], -1)
    seqs_geary = np.array(seqs_geary, dtype=np.float32)
    seqs_geary = seqs_geary.reshape(seqs_geary.shape[0], -1)
    seqs_dde = np.array(seqs_dde, dtype=np.float32)
    seqs_dde = seqs_dde.reshape(seqs_dde.shape[0], -1)
    work2vec = work2vec.reshape(work2vec.shape[0], -1)
    seqs_ctrial = seqs_ctrial.reshape(seqs_ctrial.shape[0], -1)
    seqs_ksctriad = seqs_ksctriad.reshape(seqs_ksctriad.shape[0], -1)
    seqs_blosum62 = seqs_blosum62.reshape(seqs_blosum62.shape[0], -1)
    seqs_gtpc = seqs_gtpc.reshape(seqs_gtpc.shape[0], -1)
    seqs_cksaagp = seqs_cksaagp.reshape(seqs_cksaagp.shape[0], -1)
    seqs_gaac = seqs_gaac.reshape(seqs_gaac.shape[0], -1)
    seqs_cksaap = seqs_cksaap.reshape(seqs_cksaap.shape[0], -1)
    seqs_aaindex = seqs_aaindex.reshape(seqs_aaindex.shape[0], -1)
    seqs_dpc = seqs_dpc.reshape(seqs_dpc.shape[0], -1)
    seqs_paac = seqs_paac.reshape(seqs_paac.shape[0], -1)
    seqs_gdpc = seqs_gdpc.reshape(seqs_gdpc.shape[0], -1)

    data_features = np.concatenate((seqs_blosum62, seqs_ksctriad, seqs_cksaap, seqs_aaindex), 1)
    data_features1 = np.concatenate((seqs_blosum62, seqs_aac, seqs_ctdt, seqs_aaindex), 1)
    data_features2 = np.concatenate((seqs_sr, seqs_dde), 1)
    data_features3 = np.concatenate((seqs_blosum62, seqs_ctrial, seqs_gtpc, seqs_cksaap), 1)
    data_features4 = np.concatenate((seqs_blosum62, seqs_dpc, seqs_cksaap, seqs_aaindex), 1)
    data_features5 = np.concatenate((seqs_blosum62, seqs_aac, seqs_dpc, seqs_ctrial), 1)
    data_features6 = np.concatenate((seqs_blosum62, seqs_dde, seqs_gtpc, seqs_gaac), 1)
    data_features7 = np.concatenate((seqs_ctdt, seqs_cksaap, seqs_aaindex), 1)
    data_features8 = np.concatenate((seqs_aac, seqs_cksaap, seqs_aaindex), 1)
    data_features9 = np.concatenate((seqs_blosum62, seqs_cksaap, seqs_aaindex), 1)
    data_features10 = np.concatenate((seqs_blosum62, seqs_aac, seqs_dpc), 1)
    data_features11 = np.concatenate((seqs_blosum62, seqs_gaac, seqs_cksaap), 1)
    data_features12 = np.concatenate((seqs_blosum62, seqs_sr, seqs_cksaap, seqs_aaindex), 1)
    data_features13 = np.concatenate((seqs_blosum62, seqs_dde, seqs_dpc, seqs_ksctriad), 1)
    data_features14 = np.concatenate((seqs_blosum62, seqs_dde, seqs_dpc, seqs_aaindex), 1)
    data_features15 = np.concatenate((seqs_blosum62, seqs_aac, seqs_ksctriad, seqs_cksaap), 1)
    data_features16 = np.concatenate((seqs_blosum62, seqs_aac, seqs_ctdt, seqs_cksaap), 1)
    data_features17 = np.concatenate((seqs_blosum62, seqs_dpc, seqs_gaac, seqs_cksaap), 1)
    data_features18 = np.concatenate((seqs_blosum62, seqs_dpc, seqs_ctdt, seqs_aaindex), 1)
    data_features19 = np.concatenate((seqs_cksaap, seqs_aaindex), 1)

    data_features20 = np.concatenate((seqs_blosum62, seqs_sr, seqs_dde, seqs_aac, seqs_dpc), 1)

    data_features21 = np.concatenate((seqs_blosum62, seqs_sr, seqs_dde, seqs_aac, seqs_ctdt), 1)

    data_features22 = np.concatenate((seqs_paac, seqs_blosum62, seqs_sr, seqs_dde, seqs_cksaap), 1)

    data_features23 = np.concatenate((seqs_cksaap, seqs_aaindex, seqs_blosum62, seqs_z, seqs_paac), 1)

    label = np.array(label)

    label = label.reshape(label.shape[0], )

    return data_features, data_features1, data_features2, data_features3, data_features4, data_features5, data_features6, data_features7, data_features8, data_features9, data_features10, data_features11, data_features12, data_features13, data_features14, data_features15, data_features16, data_features17, data_features18, data_features19, data_features20, data_features21, data_features22, data_features23, label


data_features, data_features1, data_features2, data_features3, data_features4, data_features5, data_features6, data_features7, data_features8, data_features9, data_features10, data_features11, data_features12, data_features13, data_features14, data_features15, data_features16, data_features17, data_features18, data_features19, data_features20, data_features21, data_features22, data_features23, label = init_data(
    "data\Toxic\\Toxit_Train.fa")

te_data_features, te_data_features1, te_data_features2, te_data_features3, te_data_features4, te_data_features5, te_data_features6, te_data_features7, te_data_features8, te_data_features9, te_data_features10, te_data_features11, te_data_features12, te_data_features13, te_data_features14, te_data_features15, te_data_features16, te_data_features17, te_data_features18, te_data_features19, te_data_features20, te_data_features21, te_data_features22, te_data_features23, te_label = init_data(
    "data\Toxic\\Toxit_Test.fa")

ml_model = XGBClassifier(use_label_encoder=False)
# ml_model1 = XGBClassifier(use_label_encoder=False)
ml_model2 = XGBClassifier(use_label_encoder=False)
ml_model3 = XGBClassifier(use_label_encoder=False)
ml_model4 = XGBClassifier(use_label_encoder=False)
ml_model5 = XGBClassifier(use_label_encoder=False)
ml_model6 = XGBClassifier(use_label_encoder=False)
ml_model7 = XGBClassifier(use_label_encoder=False)
ml_model8 = XGBClassifier(use_label_encoder=False)
# ml_model9 = XGBClassifier(use_label_encoder=False)
ml_model10 = XGBClassifier(use_label_encoder=False)

# ml_model11 = XGBClassifier(use_label_encoder=False)
# ml_model12 = XGBClassifier(use_label_encoder=False)
# ml_model13 = XGBClassifier(use_label_encoder=False)
# ml_model14 = XGBClassifier(use_label_encoder=False)
# ml_model15 = XGBClassifier(use_label_encoder=False)
# ml_model16 = XGBClassifier(use_label_encoder=False)
# ml_model17 = XGBClassifier(use_label_encoder=False)
# ml_model18 = XGBClassifier(use_label_encoder=False)
# ml_model19 = XGBClassifier(use_label_encoder=False)

ml_model20 = XGBClassifier(use_label_encoder=False)
ml_model21 = XGBClassifier(use_label_encoder=False)
# ml_model22 = XGBClassifier(use_label_encoder=False)

ml_model23 = XGBClassifier(use_label_encoder=False)

estimator = VotingClassifier(estimators=[
    ('log_clf', LogisticRegression()),
    ('svm_clf', svm.SVC(probability=True)),

], voting='soft')

estimator1 = VotingClassifier(estimators=[
    ('log_clf', LogisticRegression()),
    ('svm_clf', svm.SVC(probability=True)),

], voting='soft')

# estimator2 = VotingClassifier(estimators=[
#     ('log_clf', LogisticRegression()),
#     ('svm_clf', svm.SVC(probability=True)),
#
#
#
# ], voting='soft')

estimator3 = VotingClassifier(estimators=[
    ('log_clf', LogisticRegression()),
    ('svm_clf', svm.SVC(probability=True)),

], voting='soft')

estimator4 = VotingClassifier(estimators=[
    ('log_clf', LogisticRegression()),
    ('svm_clf', svm.SVC(probability=True)),

], voting='soft')

estimator5 = VotingClassifier(estimators=[
    ('log_clf', LogisticRegression()),
    ('svm_clf', svm.SVC(probability=True)),

], voting='soft')

ml_model.fit(data_features, label)
print("0")
# ml_model1.fit(data_features1, label)
# print("1")
ml_model2.fit(data_features2, label)
print("2")
ml_model3.fit(data_features3, label)
print("3")
ml_model4.fit(data_features4, label)
print("4")
ml_model5.fit(data_features5, label)
print("5")
ml_model6.fit(data_features6, label)
print("6")
ml_model7.fit(data_features7, label)
print("7")
ml_model8.fit(data_features8, label)
print("8")
# ml_model9.fit(data_features9, label)
# print("9")
ml_model10.fit(data_features10, label)
print("10")
# ml_model11.fit(data_features11, label)
# print("11")
# ml_model12.fit(data_features12, label)
# print("12")
# ml_model13.fit(data_features13, label)
# print("13")
# ml_model14.fit(data_features14, label)
# print("14")
# ml_model15.fit(data_features15, label)
# print("15")
# ml_model16.fit(data_features16, label)
# print("16")
# ml_model17.fit(data_features17, label)
# print("17")
# ml_model18.fit(data_features18, label)
# print("18")
# ml_model19.fit(data_features19, label)
# print("19")
ml_model20.fit(data_features20, label)
print("20")
ml_model21.fit(data_features21, label)
print("21")
# ml_model22.fit(data_features22, label)
# print("22")

ml_model23.fit(data_features23, label)
print("23")

y_pred = ml_model.predict(te_data_features)

print("MCC: ", matthews_corrcoef(te_label, y_pred))
print(classification_report(te_label, y_pred, digits=5))
print("======================0=============================")

# y_pred1 = ml_model1.predict(te_data_features1)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred1))
# print(classification_report(te_label, y_pred1, digits= 5))
# print("======================1=============================")

y_pred2 = ml_model2.predict(te_data_features2)

print("MCC: ", matthews_corrcoef(te_label, y_pred2))
print(classification_report(te_label, y_pred2, digits=5))
print("======================2=============================")

y_pred3 = ml_model3.predict(te_data_features3)

print("MCC: ", matthews_corrcoef(te_label, y_pred3))
print(classification_report(te_label, y_pred3, digits=5))
print("======================3=============================")

y_pred4 = ml_model4.predict(te_data_features4)

print("MCC: ", matthews_corrcoef(te_label, y_pred4))
print(classification_report(te_label, y_pred4, digits=5))
print("======================4=============================")

y_pred5 = ml_model5.predict(te_data_features5)

print("MCC: ", matthews_corrcoef(te_label, y_pred5))
print(classification_report(te_label, y_pred5, digits=5))
print("======================5=============================")

y_pred6 = ml_model6.predict(te_data_features6)

print("MCC: ", matthews_corrcoef(te_label, y_pred6))
print(classification_report(te_label, y_pred6, digits=5))
print("======================6=============================")

y_pred7 = ml_model7.predict(te_data_features7)

print("MCC: ", matthews_corrcoef(te_label, y_pred7))
print(classification_report(te_label, y_pred7, digits=5))
print("======================7=============================")

y_pred8 = ml_model8.predict(te_data_features8)

print("MCC: ", matthews_corrcoef(te_label, y_pred8))
print(classification_report(te_label, y_pred8, digits=5))
print("======================8=============================")

# y_pred9 = ml_model9.predict(te_data_features9)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred9))
# print(classification_report(te_label, y_pred9, digits= 5))
# print("======================9=============================")

y_pred10 = ml_model10.predict(te_data_features10)

print("MCC: ", matthews_corrcoef(te_label, y_pred10))
print(classification_report(te_label, y_pred10, digits=5))
print("======================10=============================")

# y_pred11 = ml_model11.predict(te_data_features11)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred11))
# print(classification_report(te_label, y_pred11, digits= 5))
# print("======================11=============================")
#
# y_pred12 = ml_model12.predict(te_data_features12)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred12))
# print(classification_report(te_label, y_pred12, digits= 5))
# print("======================12=============================")
#
# y_pred13 = ml_model13.predict(te_data_features13)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred13))
# print(classification_report(te_label, y_pred13, digits= 5))
# print("======================13=============================")
#
# y_pred14 = ml_model14.predict(te_data_features14)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred14))
# print(classification_report(te_label, y_pred14, digits= 5))
# print("======================14=============================")
#
# y_pred15 = ml_model15.predict(te_data_features15)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred15))
# print(classification_report(te_label, y_pred15, digits= 5))
# print("======================15=============================")
# y_pred16 = ml_model16.predict(te_data_features16)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred16))
# print(classification_report(te_label, y_pred16, digits= 5))
# print("======================16=============================")
# y_pred17 = ml_model17.predict(te_data_features17)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred17))
# print(classification_report(te_label, y_pred17, digits= 5))
# print("======================17=============================")
# y_pred18 = ml_model18.predict(te_data_features18)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred18))
# print(classification_report(te_label, y_pred18, digits= 5))
# print("======================18=============================")
# y_pred19 = ml_model19.predict(te_data_features19)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred19))
# print(classification_report(te_label, y_pred19, digits= 5))
# print("======================19=============================")
y_pred20 = ml_model20.predict(te_data_features20)

print("MCC: ", matthews_corrcoef(te_label, y_pred20))
print(classification_report(te_label, y_pred20, digits=5))
print("======================20=============================")
y_pred21 = ml_model21.predict(te_data_features21)

print("MCC: ", matthews_corrcoef(te_label, y_pred21))
print(classification_report(te_label, y_pred21, digits=5))
print("======================21=============================")
# y_pred22 = ml_model22.predict(te_data_features22)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred22))
# print(classification_report(te_label, y_pred22, digits= 5))
# print("======================22=============================")

y_pred23 = ml_model23.predict(te_data_features23)

print("MCC: ", matthews_corrcoef(te_label, y_pred23))
print(classification_report(te_label, y_pred23, digits=5))
print("======================23=============================")

t_pred = ml_model.predict(data_features)
# t_pred1 = ml_model1.predict(data_features1)
t_pred2 = ml_model2.predict(data_features2)
t_pred3 = ml_model3.predict(data_features3)
t_pred4 = ml_model4.predict(data_features4)
t_pred5 = ml_model5.predict(data_features5)
t_pred6 = ml_model6.predict(data_features6)
t_pred7 = ml_model7.predict(data_features7)
t_pred8 = ml_model8.predict(data_features8)
# t_pred9 = ml_model9.predict(data_features9)
t_pred10 = ml_model10.predict(data_features10)
# t_pred11 = ml_model11.predict(data_features11)
# t_pred12 = ml_model12.predict(data_features12)
# t_pred13 = ml_model13.predict(data_features13)
# t_pred14 = ml_model14.predict(data_features14)
# t_pred15 = ml_model15.predict(data_features15)
# t_pred16 = ml_model16.predict(data_features16)
# t_pred17 = ml_model17.predict(data_features17)
# t_pred18 = ml_model18.predict(data_features18)
# t_pred19 = ml_model19.predict(data_features19)
t_pred20 = ml_model20.predict(data_features20)
t_pred21 = ml_model21.predict(data_features21)
# t_pred22 = ml_model22.predict(data_features22)

t_pred23 = ml_model23.predict(data_features23)

y_pred = y_pred.reshape(y_pred.shape[0], 1)
# y_pred1 = y_pred1.reshape(y_pred1.shape[0], 1)
y_pred2 = y_pred2.reshape(y_pred2.shape[0], 1)
y_pred3 = y_pred3.reshape(y_pred3.shape[0], 1)
y_pred4 = y_pred4.reshape(y_pred4.shape[0], 1)
y_pred5 = y_pred5.reshape(y_pred5.shape[0], 1)
y_pred6 = y_pred6.reshape(y_pred6.shape[0], 1)
y_pred7 = y_pred7.reshape(y_pred7.shape[0], 1)
y_pred8 = y_pred8.reshape(y_pred8.shape[0], 1)
# y_pred9 = y_pred9.reshape(y_pred9.shape[0], 1)
y_pred10 = y_pred10.reshape(y_pred10.shape[0], 1)
# y_pred11 = y_pred11.reshape(y_pred11.shape[0], 1)
# y_pred12 = y_pred12.reshape(y_pred12.shape[0], 1)
# y_pred13 = y_pred13.reshape(y_pred13.shape[0], 1)
# y_pred14 = y_pred14.reshape(y_pred14.shape[0], 1)
# y_pred15 = y_pred15.reshape(y_pred15.shape[0], 1)
# y_pred16 = y_pred16.reshape(y_pred16.shape[0], 1)
# y_pred17 = y_pred17.reshape(y_pred17.shape[0], 1)
# y_pred18 = y_pred18.reshape(y_pred18.shape[0], 1)
# y_pred19 = y_pred19.reshape(y_pred19.shape[0], 1)
y_pred20 = y_pred20.reshape(y_pred20.shape[0], 1)
y_pred21 = y_pred21.reshape(y_pred21.shape[0], 1)
# y_pred22 = y_pred22.reshape(y_pred22.shape[0], 1)

y_pred23 = y_pred23.reshape(y_pred23.shape[0], 1)

t_pred = t_pred.reshape(t_pred.shape[0], 1)
# t_pred1 = t_pred1.reshape(t_pred1.shape[0], 1)
t_pred2 = t_pred2.reshape(t_pred2.shape[0], 1)
t_pred3 = t_pred3.reshape(t_pred3.shape[0], 1)
t_pred4 = t_pred4.reshape(t_pred4.shape[0], 1)
t_pred5 = t_pred5.reshape(t_pred5.shape[0], 1)
t_pred6 = t_pred6.reshape(t_pred6.shape[0], 1)
t_pred7 = t_pred7.reshape(t_pred7.shape[0], 1)
t_pred8 = t_pred8.reshape(t_pred8.shape[0], 1)
# t_pred9 = t_pred9.reshape(t_pred9.shape[0], 1)
t_pred10 = t_pred10.reshape(t_pred10.shape[0], 1)
# t_pred11 = t_pred11.reshape(t_pred11.shape[0], 1)
# t_pred12 = t_pred12.reshape(t_pred12.shape[0], 1)
# t_pred13 = t_pred13.reshape(t_pred13.shape[0], 1)
# t_pred14 = t_pred14.reshape(t_pred14.shape[0], 1)
# t_pred15 = t_pred15.reshape(t_pred15.shape[0], 1)
# t_pred16 = t_pred16.reshape(t_pred16.shape[0], 1)
# t_pred17 = t_pred17.reshape(t_pred17.shape[0], 1)
# t_pred18 = t_pred18.reshape(t_pred18.shape[0], 1)
# t_pred19 = t_pred19.reshape(t_pred19.shape[0], 1)
t_pred20 = t_pred20.reshape(t_pred20.shape[0], 1)
t_pred21 = t_pred21.reshape(t_pred21.shape[0], 1)
# t_pred22 = t_pred22.reshape(t_pred22.shape[0], 1)

t_pred23 = t_pred23.reshape(t_pred23.shape[0], 1)

# tem_y_predx = np.concatenate((y_pred3, y_pred7, y_pred8, y_pred10, y_pred21), 1)
# tem_t_predx = np.concatenate((t_pred3, t_pred7, t_pred8,  t_pred10, t_pred21), 1)
# estimator.fit(tem_t_predx, label)
# tem_y_predx1 = estimator.predict(tem_y_predx)
# tem_t_predx1 = estimator.predict(tem_t_predx)
# print(classification_report((tem_y_predx1), te_label, digits=4))
# print("=========1===========")
# tem_y_predx1 = tem_y_predx1.reshape(tem_y_predx1.shape[0], 1)
# tem_t_predx1 = tem_t_predx1.reshape(tem_t_predx1.shape[0], 1)

tem1_y_predx = np.concatenate((y_pred6, y_pred7, y_pred8, y_pred10, y_pred21), 1)
tem1_t_predx = np.concatenate((t_pred6, t_pred7, t_pred8, t_pred10, t_pred21), 1)

estimator1.fit(tem1_t_predx, label)
tem1_y_predx1 = estimator1.predict(tem1_y_predx)
tem1_t_predx1 = estimator1.predict(tem1_t_predx)

print(classification_report((tem1_y_predx1), te_label, digits=4))
print("=========2===========")

tem1_y_predx1 = tem1_y_predx1.reshape(tem1_y_predx1.shape[0], 1)
tem1_t_predx1 = tem1_t_predx1.reshape(tem1_t_predx1.shape[0], 1)

# tem2_y_predx = np.concatenate(
#     (y_pred3, y_pred4, y_pred5, y_pred7, y_pred8, y_pred10, y_pred21), 1)
# tem2_t_predx = np.concatenate(
#     (t_pred3, t_pred4, t_pred5 , t_pred7, t_pred8, t_pred10, t_pred21), 1)
#
# estimator2.fit(tem2_t_predx, label)
# tem2_y_predx2 = estimator2.predict(tem2_y_predx)
# tem2_t_predx2 = estimator2.predict(tem2_t_predx)
#
# print(classification_report((tem2_y_predx2), te_label, digits=4))
# print("=========3===========")
#
# tem2_y_predx2 = tem2_y_predx2.reshape(tem2_y_predx2.shape[0], 1)
# tem2_t_predx2 = tem2_t_predx2.reshape(tem2_t_predx2.shape[0], 1)

tem3_y_predx = np.concatenate(
    (y_pred10, y_pred7, y_pred20, y_pred3, y_pred4, y_pred21, y_pred23), 1)
tem3_t_predx = np.concatenate(
    (t_pred10, t_pred7, t_pred20, t_pred3, t_pred4, t_pred21, t_pred23), 1)
estimator3.fit(tem3_t_predx, label)
tem3_y_predx3 = estimator3.predict(tem3_y_predx)
tem3_t_predx3 = estimator3.predict(tem3_t_predx)

print(classification_report((tem3_y_predx3), te_label, digits=4))
print("============4========")

tem3_y_predx3 = tem3_y_predx3.reshape(tem3_y_predx3.shape[0], 1)
tem3_t_predx3 = tem3_t_predx3.reshape(tem3_t_predx3.shape[0], 1)

tem4_y_predx = np.concatenate(
    (y_pred, y_pred7, y_pred8, y_pred3, y_pred5, y_pred21, y_pred2), 1)
tem4_t_predx = np.concatenate(
    (t_pred, t_pred7, t_pred8, t_pred3, t_pred5, t_pred21, t_pred2), 1)

estimator4.fit(tem4_t_predx, label)
tem4_y_predx4 = estimator4.predict(tem4_y_predx)
tem4_t_predx4 = estimator4.predict(tem4_t_predx)

print(classification_report((tem4_y_predx4), te_label, digits=4))
print("=========5===========")

tem4_y_predx4 = tem4_y_predx4.reshape(tem4_y_predx4.shape[0], 1)
tem4_t_predx4 = tem4_t_predx4.reshape(tem4_t_predx4.shape[0], 1)

tem1_y_predx = np.concatenate((tem1_y_predx1, tem3_y_predx3, tem4_y_predx4), 1)
tem1_t_predx = np.concatenate((tem1_t_predx1, tem3_t_predx3, tem4_t_predx4), 1)

estimator5.fit(tem1_t_predx, label)

y_predx = estimator5.predict(tem1_y_predx)
print("MCC: ", matthews_corrcoef(te_label, y_predx))

print(classification_report((y_predx), te_label, digits=4))
print("=========f===========")

from xgboost import XGBClassifier
from sklearn.metrics import classification_report, matthews_corrcoef

from sklearn import svm
from feature import Feature
from sklearn.linear_model import LogisticRegression

from sklearn.ensemble import VotingClassifier

import numpy as np


def init_data(file_name):
    seqs_blosum62, label, work2vec, seqs_sr, seqs_dde, seqs_z, seqs_aac, seqs_dpc, seqs_ctdd, seqs_ctrial, seqs_ksctriad, seqs_gtpc, seqs_cksaagp, seqs_gaac, seqs_gdpc, seqs_ctdt, seqs_geary, seqs_cksaap, seqs_aaindex, seqs_paac = Feature(
        file_name)
    seqs_sr = np.array(seqs_sr, dtype=np.float32)
    seqs_ksctriad = np.array(seqs_ksctriad, dtype=np.float32)
    work2vec = np.array(work2vec, dtype=np.float32)
    seqs_blosum62 = np.array(seqs_blosum62, dtype=np.float32)
    seqs_ctrial = np.array(seqs_ctrial, dtype=np.float32)
    seqs_gtpc = np.array(seqs_gtpc, dtype=np.float32)
    seqs_cksaagp = np.array(seqs_cksaagp, dtype=np.float32)
    seqs_gaac = np.array(seqs_gaac, dtype=np.float32)
    seqs_cksaap = np.array(seqs_cksaap, dtype=np.float32)
    seqs_aaindex = np.array(seqs_aaindex, dtype=np.float32)
    seqs_paac = np.array(seqs_paac, dtype=np.float32)
    seqs_gdpc = np.array(seqs_gdpc, dtype=np.float32)
    # print(seqs_gtpc.shape)
    seqs_ctdt = np.array(seqs_ctdt, dtype=np.float32)
    seqs_ctdt = seqs_ctdt.reshape(seqs_ctdt.shape[0], -1)
    seqs_dpc = np.array(seqs_dpc, dtype=np.float32)
    seqs_dpc = seqs_dpc.reshape(seqs_dpc.shape[0], -1)
    seqs_aac = np.array(seqs_aac, dtype=np.float32)
    seqs_aac = seqs_aac.reshape(seqs_aac.shape[0], -1)
    seqs_z = np.array(seqs_z, dtype=np.float32)
    seqs_z = seqs_z.reshape(seqs_z.shape[0], -1)
    seqs_geary = np.array(seqs_geary, dtype=np.float32)
    seqs_geary = seqs_geary.reshape(seqs_geary.shape[0], -1)
    seqs_dde = np.array(seqs_dde, dtype=np.float32)
    seqs_dde = seqs_dde.reshape(seqs_dde.shape[0], -1)
    work2vec = work2vec.reshape(work2vec.shape[0], -1)
    seqs_ctrial = seqs_ctrial.reshape(seqs_ctrial.shape[0], -1)
    seqs_ksctriad = seqs_ksctriad.reshape(seqs_ksctriad.shape[0], -1)
    seqs_blosum62 = seqs_blosum62.reshape(seqs_blosum62.shape[0], -1)
    seqs_gtpc = seqs_gtpc.reshape(seqs_gtpc.shape[0], -1)
    seqs_cksaagp = seqs_cksaagp.reshape(seqs_cksaagp.shape[0], -1)
    seqs_gaac = seqs_gaac.reshape(seqs_gaac.shape[0], -1)
    seqs_cksaap = seqs_cksaap.reshape(seqs_cksaap.shape[0], -1)
    seqs_aaindex = seqs_aaindex.reshape(seqs_aaindex.shape[0], -1)
    seqs_dpc = seqs_dpc.reshape(seqs_dpc.shape[0], -1)
    seqs_paac = seqs_paac.reshape(seqs_paac.shape[0], -1)
    seqs_gdpc = seqs_gdpc.reshape(seqs_gdpc.shape[0], -1)

    data_features = np.concatenate((seqs_blosum62, seqs_ksctriad, seqs_cksaap, seqs_aaindex), 1)
    data_features1 = np.concatenate((seqs_blosum62, seqs_aac, seqs_ctdt, seqs_aaindex), 1)
    data_features2 = np.concatenate((seqs_sr, seqs_dde), 1)
    data_features3 = np.concatenate((seqs_blosum62, seqs_ctrial, seqs_gtpc, seqs_cksaap), 1)
    data_features4 = np.concatenate((seqs_blosum62, seqs_dpc, seqs_cksaap, seqs_aaindex), 1)
    data_features5 = np.concatenate((seqs_blosum62, seqs_aac, seqs_dpc, seqs_ctrial), 1)
    data_features6 = np.concatenate((seqs_blosum62, seqs_dde, seqs_gtpc, seqs_gaac), 1)
    data_features7 = np.concatenate((seqs_ctdt, seqs_cksaap, seqs_aaindex), 1)
    data_features8 = np.concatenate((seqs_aac, seqs_cksaap, seqs_aaindex), 1)
    data_features9 = np.concatenate((seqs_blosum62, seqs_cksaap, seqs_aaindex), 1)
    data_features10 = np.concatenate((seqs_blosum62, seqs_aac, seqs_dpc), 1)
    data_features11 = np.concatenate((seqs_blosum62, seqs_gaac, seqs_cksaap), 1)
    data_features12 = np.concatenate((seqs_blosum62, seqs_sr, seqs_cksaap, seqs_aaindex), 1)
    data_features13 = np.concatenate((seqs_blosum62, seqs_dde, seqs_dpc, seqs_ksctriad), 1)
    data_features14 = np.concatenate((seqs_blosum62, seqs_dde, seqs_dpc, seqs_aaindex), 1)
    data_features15 = np.concatenate((seqs_blosum62, seqs_aac, seqs_ksctriad, seqs_cksaap), 1)
    data_features16 = np.concatenate((seqs_blosum62, seqs_aac, seqs_ctdt, seqs_cksaap), 1)
    data_features17 = np.concatenate((seqs_blosum62, seqs_dpc, seqs_gaac, seqs_cksaap), 1)
    data_features18 = np.concatenate((seqs_blosum62, seqs_dpc, seqs_ctdt, seqs_aaindex), 1)
    data_features19 = np.concatenate((seqs_cksaap, seqs_aaindex), 1)

    data_features20 = np.concatenate((seqs_blosum62, seqs_sr, seqs_dde, seqs_aac, seqs_dpc), 1)

    data_features21 = np.concatenate((seqs_blosum62, seqs_sr, seqs_dde, seqs_aac, seqs_ctdt), 1)

    data_features22 = np.concatenate((seqs_paac, seqs_blosum62, seqs_sr, seqs_dde, seqs_cksaap), 1)

    data_features23 = np.concatenate((seqs_cksaap, seqs_aaindex, seqs_blosum62, seqs_z, seqs_paac), 1)

    label = np.array(label)

    label = label.reshape(label.shape[0], )

    return data_features, data_features1, data_features2, data_features3, data_features4, data_features5, data_features6, data_features7, data_features8, data_features9, data_features10, data_features11, data_features12, data_features13, data_features14, data_features15, data_features16, data_features17, data_features18, data_features19, data_features20, data_features21, data_features22, data_features23, label


data_features, data_features1, data_features2, data_features3, data_features4, data_features5, data_features6, data_features7, data_features8, data_features9, data_features10, data_features11, data_features12, data_features13, data_features14, data_features15, data_features16, data_features17, data_features18, data_features19, data_features20, data_features21, data_features22, data_features23, label = init_data(
    "data\Toxic\\Toxit_Train.fa")

te_data_features, te_data_features1, te_data_features2, te_data_features3, te_data_features4, te_data_features5, te_data_features6, te_data_features7, te_data_features8, te_data_features9, te_data_features10, te_data_features11, te_data_features12, te_data_features13, te_data_features14, te_data_features15, te_data_features16, te_data_features17, te_data_features18, te_data_features19, te_data_features20, te_data_features21, te_data_features22, te_data_features23, te_label = init_data(
    "data\Toxic\\Toxit_Test.fa")

ml_model = XGBClassifier(use_label_encoder=False)
# ml_model1 = XGBClassifier(use_label_encoder=False)
ml_model2 = XGBClassifier(use_label_encoder=False)
ml_model3 = XGBClassifier(use_label_encoder=False)
ml_model4 = XGBClassifier(use_label_encoder=False)
ml_model5 = XGBClassifier(use_label_encoder=False)
ml_model6 = XGBClassifier(use_label_encoder=False)
ml_model7 = XGBClassifier(use_label_encoder=False)
ml_model8 = XGBClassifier(use_label_encoder=False)
# ml_model9 = XGBClassifier(use_label_encoder=False)
ml_model10 = XGBClassifier(use_label_encoder=False)

# ml_model11 = XGBClassifier(use_label_encoder=False)
# ml_model12 = XGBClassifier(use_label_encoder=False)
# ml_model13 = XGBClassifier(use_label_encoder=False)
# ml_model14 = XGBClassifier(use_label_encoder=False)
# ml_model15 = XGBClassifier(use_label_encoder=False)
# ml_model16 = XGBClassifier(use_label_encoder=False)
# ml_model17 = XGBClassifier(use_label_encoder=False)
# ml_model18 = XGBClassifier(use_label_encoder=False)
# ml_model19 = XGBClassifier(use_label_encoder=False)

ml_model20 = XGBClassifier(use_label_encoder=False)
ml_model21 = XGBClassifier(use_label_encoder=False)
# ml_model22 = XGBClassifier(use_label_encoder=False)

ml_model23 = XGBClassifier(use_label_encoder=False)

estimator = VotingClassifier(estimators=[
    ('log_clf', LogisticRegression()),
    ('svm_clf', svm.SVC(probability=True)),

], voting='soft')

estimator1 = VotingClassifier(estimators=[
    ('log_clf', LogisticRegression()),
    ('svm_clf', svm.SVC(probability=True)),

], voting='soft')

# estimator2 = VotingClassifier(estimators=[
#     ('log_clf', LogisticRegression()),
#     ('svm_clf', svm.SVC(probability=True)),
#
#
#
# ], voting='soft')

estimator3 = VotingClassifier(estimators=[
    ('log_clf', LogisticRegression()),
    ('svm_clf', svm.SVC(probability=True)),

], voting='soft')

estimator4 = VotingClassifier(estimators=[
    ('log_clf', LogisticRegression()),
    ('svm_clf', svm.SVC(probability=True)),

], voting='soft')

estimator5 = VotingClassifier(estimators=[
    ('log_clf', LogisticRegression()),
    ('svm_clf', svm.SVC(probability=True)),

], voting='soft')

ml_model.fit(data_features, label)
print("0")
# ml_model1.fit(data_features1, label)
# print("1")
ml_model2.fit(data_features2, label)
print("2")
ml_model3.fit(data_features3, label)
print("3")
ml_model4.fit(data_features4, label)
print("4")
ml_model5.fit(data_features5, label)
print("5")
ml_model6.fit(data_features6, label)
print("6")
ml_model7.fit(data_features7, label)
print("7")
ml_model8.fit(data_features8, label)
print("8")
# ml_model9.fit(data_features9, label)
# print("9")
ml_model10.fit(data_features10, label)
print("10")
# ml_model11.fit(data_features11, label)
# print("11")
# ml_model12.fit(data_features12, label)
# print("12")
# ml_model13.fit(data_features13, label)
# print("13")
# ml_model14.fit(data_features14, label)
# print("14")
# ml_model15.fit(data_features15, label)
# print("15")
# ml_model16.fit(data_features16, label)
# print("16")
# ml_model17.fit(data_features17, label)
# print("17")
# ml_model18.fit(data_features18, label)
# print("18")
# ml_model19.fit(data_features19, label)
# print("19")
ml_model20.fit(data_features20, label)
print("20")
ml_model21.fit(data_features21, label)
print("21")
# ml_model22.fit(data_features22, label)
# print("22")

ml_model23.fit(data_features23, label)
print("23")

y_pred = ml_model.predict(te_data_features)

print("MCC: ", matthews_corrcoef(te_label, y_pred))
print(classification_report(te_label, y_pred, digits=5))
print("======================0=============================")

# y_pred1 = ml_model1.predict(te_data_features1)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred1))
# print(classification_report(te_label, y_pred1, digits= 5))
# print("======================1=============================")

y_pred2 = ml_model2.predict(te_data_features2)

print("MCC: ", matthews_corrcoef(te_label, y_pred2))
print(classification_report(te_label, y_pred2, digits=5))
print("======================2=============================")

y_pred3 = ml_model3.predict(te_data_features3)

print("MCC: ", matthews_corrcoef(te_label, y_pred3))
print(classification_report(te_label, y_pred3, digits=5))
print("======================3=============================")

y_pred4 = ml_model4.predict(te_data_features4)

print("MCC: ", matthews_corrcoef(te_label, y_pred4))
print(classification_report(te_label, y_pred4, digits=5))
print("======================4=============================")

y_pred5 = ml_model5.predict(te_data_features5)

print("MCC: ", matthews_corrcoef(te_label, y_pred5))
print(classification_report(te_label, y_pred5, digits=5))
print("======================5=============================")

y_pred6 = ml_model6.predict(te_data_features6)

print("MCC: ", matthews_corrcoef(te_label, y_pred6))
print(classification_report(te_label, y_pred6, digits=5))
print("======================6=============================")

y_pred7 = ml_model7.predict(te_data_features7)

print("MCC: ", matthews_corrcoef(te_label, y_pred7))
print(classification_report(te_label, y_pred7, digits=5))
print("======================7=============================")

y_pred8 = ml_model8.predict(te_data_features8)

print("MCC: ", matthews_corrcoef(te_label, y_pred8))
print(classification_report(te_label, y_pred8, digits=5))
print("======================8=============================")

# y_pred9 = ml_model9.predict(te_data_features9)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred9))
# print(classification_report(te_label, y_pred9, digits= 5))
# print("======================9=============================")

y_pred10 = ml_model10.predict(te_data_features10)

print("MCC: ", matthews_corrcoef(te_label, y_pred10))
print(classification_report(te_label, y_pred10, digits=5))
print("======================10=============================")

# y_pred11 = ml_model11.predict(te_data_features11)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred11))
# print(classification_report(te_label, y_pred11, digits= 5))
# print("======================11=============================")
#
# y_pred12 = ml_model12.predict(te_data_features12)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred12))
# print(classification_report(te_label, y_pred12, digits= 5))
# print("======================12=============================")
#
# y_pred13 = ml_model13.predict(te_data_features13)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred13))
# print(classification_report(te_label, y_pred13, digits= 5))
# print("======================13=============================")
#
# y_pred14 = ml_model14.predict(te_data_features14)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred14))
# print(classification_report(te_label, y_pred14, digits= 5))
# print("======================14=============================")
#
# y_pred15 = ml_model15.predict(te_data_features15)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred15))
# print(classification_report(te_label, y_pred15, digits= 5))
# print("======================15=============================")
# y_pred16 = ml_model16.predict(te_data_features16)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred16))
# print(classification_report(te_label, y_pred16, digits= 5))
# print("======================16=============================")
# y_pred17 = ml_model17.predict(te_data_features17)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred17))
# print(classification_report(te_label, y_pred17, digits= 5))
# print("======================17=============================")
# y_pred18 = ml_model18.predict(te_data_features18)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred18))
# print(classification_report(te_label, y_pred18, digits= 5))
# print("======================18=============================")
# y_pred19 = ml_model19.predict(te_data_features19)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred19))
# print(classification_report(te_label, y_pred19, digits= 5))
# print("======================19=============================")
y_pred20 = ml_model20.predict(te_data_features20)

print("MCC: ", matthews_corrcoef(te_label, y_pred20))
print(classification_report(te_label, y_pred20, digits=5))
print("======================20=============================")
y_pred21 = ml_model21.predict(te_data_features21)

print("MCC: ", matthews_corrcoef(te_label, y_pred21))
print(classification_report(te_label, y_pred21, digits=5))
print("======================21=============================")
# y_pred22 = ml_model22.predict(te_data_features22)
#
# print("MCC: ", matthews_corrcoef(te_label, y_pred22))
# print(classification_report(te_label, y_pred22, digits= 5))
# print("======================22=============================")

y_pred23 = ml_model23.predict(te_data_features23)

print("MCC: ", matthews_corrcoef(te_label, y_pred23))
print(classification_report(te_label, y_pred23, digits=5))
print("======================23=============================")

t_pred = ml_model.predict(data_features)
# t_pred1 = ml_model1.predict(data_features1)
t_pred2 = ml_model2.predict(data_features2)
t_pred3 = ml_model3.predict(data_features3)
t_pred4 = ml_model4.predict(data_features4)
t_pred5 = ml_model5.predict(data_features5)
t_pred6 = ml_model6.predict(data_features6)
t_pred7 = ml_model7.predict(data_features7)
t_pred8 = ml_model8.predict(data_features8)
# t_pred9 = ml_model9.predict(data_features9)
t_pred10 = ml_model10.predict(data_features10)
# t_pred11 = ml_model11.predict(data_features11)
# t_pred12 = ml_model12.predict(data_features12)
# t_pred13 = ml_model13.predict(data_features13)
# t_pred14 = ml_model14.predict(data_features14)
# t_pred15 = ml_model15.predict(data_features15)
# t_pred16 = ml_model16.predict(data_features16)
# t_pred17 = ml_model17.predict(data_features17)
# t_pred18 = ml_model18.predict(data_features18)
# t_pred19 = ml_model19.predict(data_features19)
t_pred20 = ml_model20.predict(data_features20)
t_pred21 = ml_model21.predict(data_features21)
# t_pred22 = ml_model22.predict(data_features22)

t_pred23 = ml_model23.predict(data_features23)

y_pred = y_pred.reshape(y_pred.shape[0], 1)
# y_pred1 = y_pred1.reshape(y_pred1.shape[0], 1)
y_pred2 = y_pred2.reshape(y_pred2.shape[0], 1)
y_pred3 = y_pred3.reshape(y_pred3.shape[0], 1)
y_pred4 = y_pred4.reshape(y_pred4.shape[0], 1)
y_pred5 = y_pred5.reshape(y_pred5.shape[0], 1)
y_pred6 = y_pred6.reshape(y_pred6.shape[0], 1)
y_pred7 = y_pred7.reshape(y_pred7.shape[0], 1)
y_pred8 = y_pred8.reshape(y_pred8.shape[0], 1)
# y_pred9 = y_pred9.reshape(y_pred9.shape[0], 1)
y_pred10 = y_pred10.reshape(y_pred10.shape[0], 1)
# y_pred11 = y_pred11.reshape(y_pred11.shape[0], 1)
# y_pred12 = y_pred12.reshape(y_pred12.shape[0], 1)
# y_pred13 = y_pred13.reshape(y_pred13.shape[0], 1)
# y_pred14 = y_pred14.reshape(y_pred14.shape[0], 1)
# y_pred15 = y_pred15.reshape(y_pred15.shape[0], 1)
# y_pred16 = y_pred16.reshape(y_pred16.shape[0], 1)
# y_pred17 = y_pred17.reshape(y_pred17.shape[0], 1)
# y_pred18 = y_pred18.reshape(y_pred18.shape[0], 1)
# y_pred19 = y_pred19.reshape(y_pred19.shape[0], 1)
y_pred20 = y_pred20.reshape(y_pred20.shape[0], 1)
y_pred21 = y_pred21.reshape(y_pred21.shape[0], 1)
# y_pred22 = y_pred22.reshape(y_pred22.shape[0], 1)

y_pred23 = y_pred23.reshape(y_pred23.shape[0], 1)

t_pred = t_pred.reshape(t_pred.shape[0], 1)
# t_pred1 = t_pred1.reshape(t_pred1.shape[0], 1)
t_pred2 = t_pred2.reshape(t_pred2.shape[0], 1)
t_pred3 = t_pred3.reshape(t_pred3.shape[0], 1)
t_pred4 = t_pred4.reshape(t_pred4.shape[0], 1)
t_pred5 = t_pred5.reshape(t_pred5.shape[0], 1)
t_pred6 = t_pred6.reshape(t_pred6.shape[0], 1)
t_pred7 = t_pred7.reshape(t_pred7.shape[0], 1)
t_pred8 = t_pred8.reshape(t_pred8.shape[0], 1)
# t_pred9 = t_pred9.reshape(t_pred9.shape[0], 1)
t_pred10 = t_pred10.reshape(t_pred10.shape[0], 1)
# t_pred11 = t_pred11.reshape(t_pred11.shape[0], 1)
# t_pred12 = t_pred12.reshape(t_pred12.shape[0], 1)
# t_pred13 = t_pred13.reshape(t_pred13.shape[0], 1)
# t_pred14 = t_pred14.reshape(t_pred14.shape[0], 1)
# t_pred15 = t_pred15.reshape(t_pred15.shape[0], 1)
# t_pred16 = t_pred16.reshape(t_pred16.shape[0], 1)
# t_pred17 = t_pred17.reshape(t_pred17.shape[0], 1)
# t_pred18 = t_pred18.reshape(t_pred18.shape[0], 1)
# t_pred19 = t_pred19.reshape(t_pred19.shape[0], 1)
t_pred20 = t_pred20.reshape(t_pred20.shape[0], 1)
t_pred21 = t_pred21.reshape(t_pred21.shape[0], 1)
# t_pred22 = t_pred22.reshape(t_pred22.shape[0], 1)

t_pred23 = t_pred23.reshape(t_pred23.shape[0], 1)

# tem_y_predx = np.concatenate((y_pred3, y_pred7, y_pred8, y_pred10, y_pred21), 1)
# tem_t_predx = np.concatenate((t_pred3, t_pred7, t_pred8,  t_pred10, t_pred21), 1)
# estimator.fit(tem_t_predx, label)
# tem_y_predx1 = estimator.predict(tem_y_predx)
# tem_t_predx1 = estimator.predict(tem_t_predx)
# print(classification_report((tem_y_predx1), te_label, digits=4))
# print("=========1===========")
# tem_y_predx1 = tem_y_predx1.reshape(tem_y_predx1.shape[0], 1)
# tem_t_predx1 = tem_t_predx1.reshape(tem_t_predx1.shape[0], 1)

tem1_y_predx = np.concatenate((y_pred6, y_pred7, y_pred8, y_pred10, y_pred21), 1)
tem1_t_predx = np.concatenate((t_pred6, t_pred7, t_pred8, t_pred10, t_pred21), 1)

estimator1.fit(tem1_t_predx, label)
tem1_y_predx1 = estimator1.predict(tem1_y_predx)
tem1_t_predx1 = estimator1.predict(tem1_t_predx)

print(classification_report((tem1_y_predx1), te_label, digits=4))
print("=========2===========")

tem1_y_predx1 = tem1_y_predx1.reshape(tem1_y_predx1.shape[0], 1)
tem1_t_predx1 = tem1_t_predx1.reshape(tem1_t_predx1.shape[0], 1)

# tem2_y_predx = np.concatenate(
#     (y_pred3, y_pred4, y_pred5, y_pred7, y_pred8, y_pred10, y_pred21), 1)
# tem2_t_predx = np.concatenate(
#     (t_pred3, t_pred4, t_pred5 , t_pred7, t_pred8, t_pred10, t_pred21), 1)
#
# estimator2.fit(tem2_t_predx, label)
# tem2_y_predx2 = estimator2.predict(tem2_y_predx)
# tem2_t_predx2 = estimator2.predict(tem2_t_predx)
#
# print(classification_report((tem2_y_predx2), te_label, digits=4))
# print("=========3===========")
#
# tem2_y_predx2 = tem2_y_predx2.reshape(tem2_y_predx2.shape[0], 1)
# tem2_t_predx2 = tem2_t_predx2.reshape(tem2_t_predx2.shape[0], 1)

tem3_y_predx = np.concatenate(
    (y_pred10, y_pred7, y_pred20, y_pred3, y_pred4, y_pred21, y_pred23), 1)
tem3_t_predx = np.concatenate(
    (t_pred10, t_pred7, t_pred20, t_pred3, t_pred4, t_pred21, t_pred23), 1)
estimator3.fit(tem3_t_predx, label)
tem3_y_predx3 = estimator3.predict(tem3_y_predx)
tem3_t_predx3 = estimator3.predict(tem3_t_predx)

print(classification_report((tem3_y_predx3), te_label, digits=4))
print("============4========")

tem3_y_predx3 = tem3_y_predx3.reshape(tem3_y_predx3.shape[0], 1)
tem3_t_predx3 = tem3_t_predx3.reshape(tem3_t_predx3.shape[0], 1)

tem4_y_predx = np.concatenate(
    (y_pred, y_pred7, y_pred8, y_pred3, y_pred5, y_pred21, y_pred2), 1)
tem4_t_predx = np.concatenate(
    (t_pred, t_pred7, t_pred8, t_pred3, t_pred5, t_pred21, t_pred2), 1)

estimator4.fit(tem4_t_predx, label)
tem4_y_predx4 = estimator4.predict(tem4_y_predx)
tem4_t_predx4 = estimator4.predict(tem4_t_predx)

print(classification_report((tem4_y_predx4), te_label, digits=4))
print("=========5===========")

tem4_y_predx4 = tem4_y_predx4.reshape(tem4_y_predx4.shape[0], 1)
tem4_t_predx4 = tem4_t_predx4.reshape(tem4_t_predx4.shape[0], 1)

tem1_y_predx = np.concatenate((tem1_y_predx1, tem3_y_predx3, tem4_y_predx4), 1)
tem1_t_predx = np.concatenate((tem1_t_predx1, tem3_t_predx3, tem4_t_predx4), 1)

estimator5.fit(tem1_t_predx, label)

y_predx = estimator5.predict(tem1_y_predx)
print("MCC: ", matthews_corrcoef(te_label, y_predx))

print(classification_report((y_predx), te_label, digits=4))
print("=========f===========")

# print(seqs_gtpc.shape) # ml_model1 = XGBClassifier(use_label_encoder=False) # ml_model9 = XGBClassifier(use_label_encoder=False) # ml_model11 = XGBClassifier(use_label_encoder=False) # ml_model12 = XGBClassifier(use_label_encoder=False) # ml_model13 = XGBClassifier(use_label_encoder=False) # ml_model14 = XGBClassifier(use_label_encoder=False) # ml_model15 = XGBClassifier(use_label_encoder=False) # ml_model16 = XGBClassifier(use_label_encoder=False) # ml_model17 = XGBClassifier(use_label_encoder=False) # ml_model18 = XGBClassifier(use_label_encoder=False) # ml_model19 = XGBClassifier(use_label_encoder=False) # ml_model22 = XGBClassifier(use_label_encoder=False) # estimator2 = VotingClassifier(estimators=[ #     ('log_clf', LogisticRegression()), #     ('svm_clf', svm.SVC(probability=True)), # # # # ], voting='soft') # ml_model1.fit(data_features1, label) # print("1") # ml_model9.fit(data_features9, label) # print("9") # ml_model11.fit(data_features11, label) # print("11") # ml_model12.fit(data_features12, label) # print("12") # ml_model13.fit(data_features13, label) # print("13") # ml_model14.fit(data_features14, label) # print("14") # ml_model15.fit(data_features15, label) # print("15") # ml_model16.fit(data_features16, label) # print("16") # ml_model17.fit(data_features17, label) # print("17") # ml_model18.fit(data_features18, label) # print("18") # ml_model19.fit(data_features19, label) # print("19") # ml_model22.fit(data_features22, label) # print("22") # y_pred1 = ml_model1.predict(te_data_features1) # # print("MCC: ", matthews_corrcoef(te_label, y_pred1)) # print(classification_report(te_label, y_pred1, digits= 5)) # print("======================1=============================") # y_pred9 = ml_model9.predict(te_data_features9) # # print("MCC: ", matthews_corrcoef(te_label, y_pred9)) # print(classification_report(te_label, y_pred9, digits= 5)) # print("======================9=============================") # y_pred11 = ml_model11.predict(te_data_features11) # # print("MCC: ", matthews_corrcoef(te_label, y_pred11)) # print(classification_report(te_label, y_pred11, digits= 5)) # print("======================11=============================") # # y_pred12 = ml_model12.predict(te_data_features12) # # print("MCC: ", matthews_corrcoef(te_label, y_pred12)) # print(classification_report(te_label, y_pred12, digits= 5)) # print("======================12=============================") # # y_pred13 = ml_model13.predict(te_data_features13) # # print("MCC: ", matthews_corrcoef(te_label, y_pred13)) # print(classification_report(te_label, y_pred13, digits= 5)) # print("======================13=============================") # # y_pred14 = ml_model14.predict(te_data_features14) # # print("MCC: ", matthews_corrcoef(te_label, y_pred14)) # print(classification_report(te_label, y_pred14, digits= 5)) # print("======================14=============================") # # y_pred15 = ml_model15.predict(te_data_features15) # # print("MCC: ", matthews_corrcoef(te_label, y_pred15)) # print(classification_report(te_label, y_pred15, digits= 5)) # print("======================15=============================") # y_pred16 = ml_model16.predict(te_data_features16) # # print("MCC: ", matthews_corrcoef(te_label, y_pred16)) # print(classification_report(te_label, y_pred16, digits= 5)) # print("======================16=============================") # y_pred17 = ml_model17.predict(te_data_features17) # # print("MCC: ", matthews_corrcoef(te_label, y_pred17)) # print(classification_report(te_label, y_pred17, digits= 5)) # print("======================17=============================") # y_pred18 = ml_model18.predict(te_data_features18) # # print("MCC: ", matthews_corrcoef(te_label, y_pred18)) # print(classification_report(te_label, y_pred18, digits= 5)) # print("======================18=============================") # y_pred19 = ml_model19.predict(te_data_features19) # # print("MCC: ", matthews_corrcoef(te_label, y_pred19)) # print(classification_report(te_label, y_pred19, digits= 5)) # print("======================19=============================") # y_pred22 = ml_model22.predict(te_data_features22) # # print("MCC: ", matthews_corrcoef(te_label, y_pred22)) # print(classification_report(te_label, y_pred22, digits= 5)) # print("======================22=============================") # t_pred1 = ml_model1.predict(data_features1) # t_pred9 = ml_model9.predict(data_features9) # t_pred11 = ml_model11.predict(data_features11) # t_pred12 = ml_model12.predict(data_features12) # t_pred13 = ml_model13.predict(data_features13) # t_pred14 = ml_model14.predict(data_features14) # t_pred15 = ml_model15.predict(data_features15) # t_pred16 = ml_model16.predict(data_features16) # t_pred17 = ml_model17.predict(data_features17) # t_pred18 = ml_model18.predict(data_features18) # t_pred19 = ml_model19.predict(data_features19) # t_pred22 = ml_model22.predict(data_features22) # y_pred1 = y_pred1.reshape(y_pred1.shape[0], 1) # y_pred9 = y_pred9.reshape(y_pred9.shape[0], 1) # y_pred11 = y_pred11.reshape(y_pred11.shape[0], 1) # y_pred12 = y_pred12.reshape(y_pred12.shape[0], 1) # y_pred13 = y_pred13.reshape(y_pred13.shape[0], 1) # y_pred14 = y_pred14.reshape(y_pred14.shape[0], 1) # y_pred15 = y_pred15.reshape(y_pred15.shape[0], 1) # y_pred16 = y_pred16.reshape(y_pred16.shape[0], 1) # y_pred17 = y_pred17.reshape(y_pred17.shape[0], 1) # y_pred18 = y_pred18.reshape(y_pred18.shape[0], 1) # y_pred19 = y_pred19.reshape(y_pred19.shape[0], 1) # y_pred22 = y_pred22.reshape(y_pred22.shape[0], 1) # t_pred1 = t_pred1.reshape(t_pred1.shape[0], 1) # t_pred9 = t_pred9.reshape(t_pred9.shape[0], 1) # t_pred11 = t_pred11.reshape(t_pred11.shape[0], 1) # t_pred12 = t_pred12.reshape(t_pred12.shape[0], 1) # t_pred13 = t_pred13.reshape(t_pred13.shape[0], 1) # t_pred14 = t_pred14.reshape(t_pred14.shape[0], 1) # t_pred15 = t_pred15.reshape(t_pred15.shape[0], 1) # t_pred16 = t_pred16.reshape(t_pred16.shape[0], 1) # t_pred17 = t_pred17.reshape(t_pred17.shape[0], 1) # t_pred18 = t_pred18.reshape(t_pred18.shape[0], 1) # t_pred19 = t_pred19.reshape(t_pred19.shape[0], 1) # t_pred22 = t_pred22.reshape(t_pred22.shape[0], 1) # tem_y_predx = np.concatenate((y_pred3, y_pred7, y_pred8, y_pred10, y_pred21), 1) # tem_t_predx = np.concatenate((t_pred3, t_pred7, t_pred8,  t_pred10, t_pred21), 1) # estimator.fit(tem_t_predx, label) # tem_y_predx1 = estimator.predict(tem_y_predx) # tem_t_predx1 = estimator.predict(tem_t_predx) # print(classification_report((tem_y_predx1), te_label, digits=4)) # print("=========1===========") # tem_y_predx1 = tem_y_predx1.reshape(tem_y_predx1.shape[0], 1) # tem_t_predx1 = tem_t_predx1.reshape(tem_t_predx1.shape[0], 1) # tem2_y_predx = np.concatenate( #     (y_pred3, y_pred4, y_pred5, y_pred7, y_pred8, y_pred10, y_pred21), 1) # tem2_t_predx = np.concatenate( #     (t_pred3, t_pred4, t_pred5 , t_pred7, t_pred8, t_pred10, t_pred21), 1) # # estimator2.fit(tem2_t_predx, label) # tem2_y_predx2 = estimator2.predict(tem2_y_predx) # tem2_t_predx2 = estimator2.predict(tem2_t_predx) # # print(classification_report((tem2_y_predx2), te_label, digits=4)) # print("=========3===========") # # tem2_y_predx2 = tem2_y_predx2.reshape(tem2_y_predx2.shape[0], 1) # tem2_t_predx2 = tem2_t_predx2.reshape(tem2_t_predx2.shape[0], 1)