print('Number of Positive: ', RD.Num_positive)
print('Number of Negative: ', RD.Num_negative)

nominal_feature = []
data = RD.get_feature()
num_samples = data.shape[0]
num_features = data.shape[1]
num_bins = 100
bounds = np.zeros((num_bins + 1, num_features))
for i in range(num_features):
    if i not in nominal_feature:
        bounds[:, i] = np.histogram(data[:, i], bins=num_bins)[1]

nf = RD.get_negative_feature()
transfer(nf, bounds, num_features, nominal_feature)
pf = RD.get_positive_feature()
transfer(pf, bounds, num_features, nominal_feature)

bayes = BayesianNetwork.from_samples(nf, algorithm='chow-liu')
pt = bayes.log_probability(nf).sum()
print('Chow-Liu', pt)
'''
bayes = BayesianNetwork.from_samples(nf, algorithm='exact-dp')
pt = bayes.log_probability(nf).sum()
print('Exact Shortest:', pt)

bayes = BayesianNetwork.from_samples(nf, algorithm='exact')     # Error
pt = bayes.log_probability(nf).sum()
print('Exact A*', pt)

bayes = BayesianNetwork.from_samples(nf, algorithm='greedy')
    #        dir_train = "glass1-5-fold/glass1-5-" + str(j+1) + "tra.dat"
    #        dir_test = "glass1-5-fold/glass1-5-" + str(j+1) + "tst.dat"
    dir_train = "page-blocks0-5-fold/page-blocks0-5-" + str(j + 1) + "tra.dat"
    dir_test = "page-blocks0-5-fold/page-blocks0-5-" + str(j + 1) + "tst.dat"

    RD.Initialize_Data(dir_train)
    Train_Feature = RD.get_feature()
    Train_Label = RD.get_label()
    Train_Label = Train_Label.ravel()
    print(Train_Feature.shape)
    print(Train_Label.size)

    #    clf = svm.SVC(C=1, kernel='rbf', gamma= 0.2)
    #    clf.fit(Train_Feature, Train_Label)

    Feature_samples = RD.get_positive_feature()
    G = GAN_Build(Feature_samples)
    Sudo_Samples = Over_Sampling(G, RD.Num_negative - RD.Num_positive, 6)
    print(Sudo_Samples[0])
    print(Sudo_Samples[-1])
    Train_Feature = np.concatenate((Train_Feature, Sudo_Samples))
    print(Train_Feature[0])
    print(Train_Feature[-1])
    Augment_Label = np.ones((RD.Num_negative - RD.Num_positive),
                            dtype=np.int16)
    Train_Label = np.append(Train_Label, Augment_Label)
    print(Train_Feature.shape)
    print(Train_Label.size)

    clf_gan = svm.SVC(C=1, kernel='rbf', gamma=0.2)
    clf_gan.fit(Train_Feature, Train_Label)