Beispiel #1
0
while dataset_test:
    x, y = util.line_toseq(dataset_test.pop(0), charstop)
    if dense: dataset.append(util.seq_to_densevec(x, y, vdict))
    else: dataset.append(util.seq_to_sparsevec(x,y,charset))
    if not len(dataset_test)%1000: print "len(dataset_test)", len(dataset_test)
dataset_test = dataset

#This is the final test.
print "This is the test for the PEAK value."
mylstm.load(modelname + "/saving-" + str(peak))
testcost, act, aco, atp, p, r, f = mylstm.test(dataset_test)
print "\t@@VALIDATE ON TEST@@\tTotal in Gold:", act, "Total in Output:", aco, "True Positive:", atp, "Loss:", testcost
print "\t@@VALIDATE ON TEST@@\tP, R, F:", p, r, f
print "\t@@VALIDATE ON TEST@@\tTotal in Gold:", datetime.datetime.now(), datetime.datetime.now()-starttime
print "\tpeak =", peak

generate = [line for line in util.file_to_lines(glob.glob('qualitative/allover-sjw-gold*'))]
dataset_generate = []
for line in generate:
    x, y = util.line_toseq(line, charstop)
    if dense: dataset_generate.append(util.seq_to_densevec(x, y, vdict))
    else: dataset_generate.append(util.seq_to_sparsevec(x,y,charset))
    if not len(dataset_generate)%1000: print "len(dataset_generate)", len(dataset_generate)

generate = [util.line_toraw(line) for line in generate]

result = util.decode_totext(generate, mylstm.generate(dataset_generate), charstop)
for line in result:
    print line.encode('utf8')

Beispiel #2
0
# -*- coding: utf8 -*-
import util
import sys
import glob

material = '../data/24s/*'
#material = 'data/24s/*'
i = 0
for line in util.file_to_lines(glob.glob(material)):
    #i = i+1
    #print (" ".join(util.line_toraw(line)).encode('utf8'))
    print(" ".join(util.line_toraw(line)))
#print i
Beispiel #3
0
    else: dataset.append(util.seq_to_sparsevec(x,y,charset))
    print "len(dataset_test)", len(dataset_test)
dataset_test = dataset

#This is the final test.
print "This is the test for the PEAK value."
mylstm.load(modelname + "saving" + str(peak))
testcost, act, aco, atp, p, r, f = mylstm.test(dataset_test)
print "\t@@VALIDATE ON TEST@@\tTotal in Gold:", act, "Total in Output:", aco, "True Positive:", atp, "Loss:", testcost
print "\t@@VALIDATE ON TEST@@\tP, R, F:", p, r, f
print "\t@@VALIDATE ON TEST@@\tTotal in Gold:", datetime.datetime.now(), datetime.datetime.now()-starttime
print "\tpeak =", peak

generate = [line for line in util.file_to_lines(glob.glob('qualitative/allover-sjw-gold.*'))]

dataset_generate = []
while li:
    x, y = util.line_toseq(generate.pop(0), charstop)
    if dense: dataset_generate.append(util.seq_to_densevec(x, y, vdict))
    else: dataset_generate.append(util.seq_to_sparsevec(x,y,charset))
    print "len(dataset_generate)", len(dataset_generate)

li_generate = [util.line_toraw(line) for line in dataset_generate]

result = util.decode_totext(li_generate, mylstm.generate(dataset_generate), charstop)
for line in result:
    print line.encode('utf8')



dataset_test = dataset

#This is the final test.
print "This is the test for the PEAK value."
mylstm.load(modelname + "/saving-" + str(peak))
testcost, act, aco, atp, p, r, f = mylstm.test(dataset_test)
print "\t@@VALIDATE ON TEST@@\tTotal in Gold:", act, "Total in Output:", aco, "True Positive:", atp, "Loss:", testcost
print "\t@@VALIDATE ON TEST@@\tP, R, F:", p, r, f
print "\t@@VALIDATE ON TEST@@\tTotal in Gold:", datetime.datetime.now(
), datetime.datetime.now() - starttime
print "\tpeak =", peak

generate = [
    line
    for line in util.file_to_lines(glob.glob('qualitative/allover-sjw-gold*'))
]
dataset_generate = []
for line in generate:
    x, y = util.line_toseq(line, charstop)
    if dense: dataset_generate.append(util.seq_to_densevec(x, y, vdict))
    else: dataset_generate.append(util.seq_to_sparsevec(x, y, charset))
    if not len(dataset_generate) % 1000:
        print "len(dataset_generate)", len(dataset_generate)

generate = [util.line_toraw(line) for line in generate]

result = util.decode_totext(generate, mylstm.generate(dataset_generate),
                            charstop)
for line in result:
    print line.encode('utf8')
Beispiel #5
0
# -*- coding: utf8 -*-
import util
import sys
import glob

material = '../data/24s/*'
#material = 'data/24s/*'
i=0
for line in util.file_to_lines(glob.glob(material)):
    #i = i+1
    print " ".join(util.line_toraw(line)).encode('utf8')
#print i