Y_training = Y[0:200]
X_test = X[200:437]
Y_test = Y[200:437]

dbn = dbn.DBN([X_training.shape[1], 1000, 2], learn_rates=0.3, learn_rate_decays=0.9, epochs=10, verbose=1)

logReg = linear_model.LogisticRegression(C=1e6)


dbn.fit(X_training, Y_training)
logReg.fit(X_training, Y_training)

i = 0


preds, probs = dbn.predict(X_test)

total = 0
correct = 0
for xt in X_test:
    dbn_pred, dbn_prob = dbn.predict(xt)

    theta = logReg.coef_[0]
    intercept = logReg.intercept_
    logReg_pred = confidenceLogRegression(theta, xt, intercept)

    if float(dbn_prob[0][1]) >= 0.55:
        if dbn_pred[0] == Y_test[i]:
            correct += 1
        preds[i] = 1
        total += 1
        verbose=1,
        )
net1.fit(X_training_Matrix,Y_training_Matrix)

logReg = linear_model.LogisticRegression(C=1e6)
logReg.fit(X_training_Matrix, Y_training_Matrix)
dbn = dbn.DBN(
    [X_training.shape[1],1000,2],
    learn_rates = 0.3,
    learn_rate_decays = 0.9,
    epochs = 10,
    verbose = 1)
dbn.fit(X_training, Y_training)

net1Preds,net1Probs = net1.predict(X_test_Matrix)
dbnPreds,dbnProbs = dbn.predict(X_test)
logRegPreds = logReg.predict(X_test_Matrix)

print "neural network"
print classification_report(Y_test_Matrix, net1Preds)
print "deep belief network"
print classification_report(Y_test, dbnPreds)
print "logistic regression"
print classification_report(Y_test_Matrix, logRegPreds)

count = 0
i = 0
while i < 237:
    if Y_test[i] == net1Preds[i] == logRegPreds[i] == dbnPreds[i]:
        count = count + 1
        print 
mediaFeatureDBNPreds,mediaFeatureDBNProbs = dbn.predict(mediaFeatureTest)
print classification_report(Y_test_Matrix,mediaFeatureDBNPreds)
########################deep belief network with media features###########################################
"""

########################deep belief network with comment features###########################################
commentFeatureTraining =  X_training_Matrix[0:200,15:35]
commentFeatureTest = X_test_Matrix[0:237,15:35]
dbn = dbn.DBN(
    [commentFeatureTraining.shape[1],1000,2],
    learn_rates = 0.1,
    learn_rate_decays = 0.9,
    epochs = 100,
    verbose = 1)
dbn.fit(commentFeatureTraining, Y_training_Matrix)
commentFeatureDBNPreds,commentFeatureDBNProbs = dbn.predict(commentFeatureTest)
print classification_report(Y_test_Matrix,commentFeatureDBNPreds)
########################deep belief network with media features###########################################

##################### THIS IS BELIEF NETWORK ############################################


"""userFeatureTraining =  X_training_Matrix[0:200,35:]
logReg = linear_model.LogisticRegression(C=1e6)
logReg.fit(userFeatureTraining, Y_training_Matrix)


print str(X_test_Matrix.shape)+" shape of test matrix"
print "logistic regression using user features"