Exemple #1
0
def valid(outfile = 'output/new_lstm_result.pkl'):
	import unidatica
	from const import N_EMO

	n_emo = 2 #N_EMO
	dataset = unidatica.load(n_emo, 1000)
	
	lstm = LstmClassifier()
	lstm.load()

	test_x, test_y = dataset[2]
	preds_prob = lstm.classify(test_x)
	cPickle.dump((test_y, preds_prob), open(outfile, 'w'))
Exemple #2
0
def main():
	from const import N_EMO

	n_emo = 2 #N_EMO # 2

	import unidatica
	dataset = unidatica.load(n_emo, 1000) #, 1000

	lstm = LstmClassifier()
	res = lstm.train(
			dataset = dataset,
			ydim = n_emo,
			fname_model = FNAME_MODEL,
			reload_model = True,
		)
Exemple #3
0
def valid():
	import cPickle
	import tfcoder	
	from const import PKL_TFCODER, N_EMO

	coder = cPickle.load(open(PKL_TFCODER, 'r'))
	n_emo = N_EMO

	import unidatica
	dataset = unidatica.load(n_emo)
	lstm = LstmClassifier()
	lstm.load(
			ydim = n_emo,
			n_words = coder.n_code(),
		)

	test_x, test_y = dataset[2]
	preds_prob = lstm.classify(test_x)
	cPickle.dump((test_y, preds_prob), open('output/lstm_result.pkl', 'w'))
Exemple #4
0
def main():
	import cPickle
	import tfcoder	
	from const import PKL_TFCODER, N_EMO

	coder = cPickle.load(open(PKL_TFCODER, 'r'))
	n_emo = N_EMO # 2

	import unidatica
	dataset = unidatica.load(n_emo) #, 1000

	lstm = LstmClassifier()
	res = lstm.train(
			dataset = dataset,
			ydim = n_emo,
			n_words = coder.n_code(),
			fname_model = FNAME_MODEL,
			reload_model = False,
		)