Ejemplo n.º 1
0
def main(filepath, modelpath):

    """ main function 

    Args:
        filepath ([txt]): filepath containing our dataset
        modelpath ([h5]): modelpath containing our model
    """
    df, eng_deu_lines = read_file(filepath)
    dfp = process_data(df)
    eng_deu = data_array(dfp)
    eng_tok = token(eng_deu[:, 0])
    eng_len_vocab = len(eng_tok.word_index) + 1
    deu_tok = token((eng_deu[:, 1]))
    deu_len_vocab = len(deu_tok.word_index) + 1
    data_train, data_test = train_test_split(eng_deu, test_size=0.2,  
                                             random_state=1)
    X_train = encoding(data_train[:, 1], 8, deu_tok)
    y_train = encoding(data_train[:, 0], 8, eng_tok)
    X_test = encoding(data_test[:, 1], 8, deu_tok)
    y_test = encoding(data_test[:, 1], 8, deu_tok)
    model = load_model(modelpath)
    preds = model.predict_classes(X_test.reshape((X_test.shape[0], 
                                                 X_test.shape[1])))
    df_preds = prediction(preds, eng_tok)
    return df_preds
Ejemplo n.º 2
0
		timestamp_former=dp.read_file("edison/1.txt",3)
		timestamp_backer=dp.read_file('edison/2.txt',3)
		title='clock skew between Edison1 and Edison 2 '
	elif index==1:
		timestamp_former=dp.read_file("edison/1.txt",3)
		timestamp_backer=dp.read_file("edison/3.txt",3)

		title='clock skew between Edison1 and Edison 3 '
	elif index==2:
		timestamp_former=dp.read_file('edison/2.txt',3)
		timestamp_backer=dp.read_file("edison/3.txt",3)
		title='clock skew between Edison2 and Edison 3 '

	'''
        if index ==0:
		timestamp_former=dp.read_file("arduino/1.txt",2)
		timestamp_backer=dp.read_file('edison/1.txt',3)
		#timestamp_former=dp.read_file("save/scalable/800MBit/arduino.txt",2)
		#timestamp_backer=dp.read_file('save/scalable/800MBit/edison.txt',3)
                
		#title='IP stack (arduino- Edison) '
                title='Tra-Tre without background traffic '
	elif index==1:
		timestamp_former=dp.read_file("arduino/1.txt",0)
		timestamp_backer=dp.read_file("edison/1.txt",0)
		#timestamp_former=dp.read_file("save/scalable/800MBit/arduino.txt",0)
		#timestamp_backer=dp.read_file('save/scalable/800MBit/edison.txt',0)

		title='Tsa-Tse without background traffic '
	elif index==2:
		timestamp_former=dp.read_file('edison/data.txt',0)
Ejemplo n.º 3
0
Archivo: draw.py Proyecto: xiao-bo/PaaS
	table_size.set_fontsize(12)
	table_size.scale(1,1)

	##set legend position
	curve.legend(bbox_to_anchor=(1.05, 1.05))
	
	plt.show()



if __name__=="__main__":
        ## main code for multicurve

	print "draw.py"
	
	timestamp_former=dp.read_file('edison/data/0%.txt',3)##edison receiver
	timestamp_backer=dp.read_file('edison/data/0%.txt',0)##edison sender
	zero_data=dp.data_process_2(timestamp_former,timestamp_backer)

	timestamp_former=dp.read_file('edison/data/20%.txt',3)##edison receiver
	timestamp_backer=dp.read_file('edison/data/20%.txt',0)##edison sender
	ten_data=dp.data_process_2(timestamp_former,timestamp_backer)

	timestamp_former=dp.read_file('edison/data/50%.txt',3)##edison receiver
	timestamp_backer=dp.read_file('edison/data/50%.txt',0)##edison sender
	five_data=dp.data_process_2(timestamp_former,timestamp_backer)

	timestamp_former=dp.read_file('edison/data/90%.txt',3)##edison receiver
	timestamp_backer=dp.read_file('edison/data/90%.txt',0)##edison sender
	nine_data=dp.data_process_2(timestamp_former,timestamp_backer)