Exemplo n.º 1
0
    valsize_mult = len(trainX_mult) - math.floor(0.2 * len(trainX_mult))
    valX_mult = array(trainX_mult[valsize_mult:len(trainX_mult)])
    valY_mult = array(trainY_mult[valsize_mult:len(trainX_mult)])

    trainX = array(trainX[:valsize])
    trainY = array(trainY[:valsize])

    trainX_mult = array(trainX_mult[:valsize_mult])
    trainY_mult = array(trainY_mult[:valsize_mult])

    testX = array(testX)
    testY = array(testY)

    print("Creating and Training GRU Bi-Classification Model ...")
    bi_history, gru_bi_prediction = nn_models.GatedRecurrentUnit(
        trainX, trainY, valX, valY, testX, testY, e)

    print("Creating and Training LSTM Bi-Classification Model ...")
    bi_history, lstm_bi_prediction = awekar_models.lstm(
        trainX, trainY, valX, valY, testX, testY, e)

    print("Creating and Training Bi-Classification Model ...")
    bi_history, bl_bi_prediction = awekar_models.blstm(trainX, trainY, valX,
                                                       valY, testX, testY, e)

    ### INSERT CONSENSUS ###

    cons_dict = []
    for g, l, b in zip(gru_bi_prediction, lstm_bi_prediction,
                       bl_bi_prediction):
Exemplo n.º 2
0
		testY.append(labels[ts])

	# VALIDATION DATA
	valsize = len(trainX) - math.floor(0.2 * len(trainX))
	valX = array(trainX[valsize:len(trainX)])
	valY = array(trainY[valsize:len(trainX)])
	trainX = array(trainX[:valsize])
	trainY = array(trainY[:valsize])

	testX = array(testX)
	testY = array(testY)


	##GRU MODEL
	print("Creating and Training GRU Model ...")
	history, pred = nn_models.GatedRecurrentUnit(trainX,trainY,valX,valY,testX,testY,e)

	f_mes = f1_score(testY,pred,average='weighted')
	a_mes = accuracy_score(testY,pred)
	p_mes = precision_score(testY,pred,average='weighted')
	r_mes = recall_score(testY,pred,average='weighted')

	bcount=0
	bully_count = 0
	nbcount=0
	non_bully_count = 0
	for x in range(len(testX)):
		if testY[x] == 1:
			bully_count = bully_count + 1
			if pred[x] == 1:
				bcount = bcount + 1