Fix model a little
This commit is contained in:
parent
fa155b7a7e
commit
3bb3c26b5d
BIN
.predict.py.swp
BIN
.predict.py.swp
Binary file not shown.
BIN
.train.py.swp
BIN
.train.py.swp
Binary file not shown.
@ -47,6 +47,8 @@ def main():
|
|||||||
#in_file = "dev-0/in.tsv"
|
#in_file = "dev-0/in.tsv"
|
||||||
out_file = "test-A/out.tsv"
|
out_file = "test-A/out.tsv"
|
||||||
#out_file = "dev-0/out.tsv"
|
#out_file = "dev-0/out.tsv"
|
||||||
|
print (f"in {in_file}")
|
||||||
|
print (f"out {out_file}")
|
||||||
with open(in_file) as in_f, open(out_file, 'w') as out_f:
|
with open(in_file) as in_f, open(out_file, 'w') as out_f:
|
||||||
for line in in_f:
|
for line in in_f:
|
||||||
hyp = calc_post_prob(line, paranormal_class_logprob, sceptic_class_logprob, word_logprobs)
|
hyp = calc_post_prob(line, paranormal_class_logprob, sceptic_class_logprob, word_logprobs)
|
||||||
|
3
train.py
3
train.py
@ -10,6 +10,7 @@ def calc_class_logprob(expected_path):
|
|||||||
sceptic_classcount=0
|
sceptic_classcount=0
|
||||||
with open(expected_path) as f:
|
with open(expected_path) as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
|
line = line.rstrip('\n').replace(' ','')
|
||||||
if 'P' in line:
|
if 'P' in line:
|
||||||
paranolal_classcount +=1
|
paranolal_classcount +=1
|
||||||
elif 'S' in line:
|
elif 'S' in line:
|
||||||
@ -70,6 +71,8 @@ def main():
|
|||||||
#expected = './dev-0/expected.tsv'
|
#expected = './dev-0/expected.tsv'
|
||||||
in_f = './train/in.tsv'
|
in_f = './train/in.tsv'
|
||||||
#in_f = './dev-0/in.tsv'
|
#in_f = './dev-0/in.tsv'
|
||||||
|
print (f"expected {expected}")
|
||||||
|
print (f"in {in_f}")
|
||||||
paranormal_class_lgprob, skeptic_class_logprob = calc_class_logprob(expected)
|
paranormal_class_lgprob, skeptic_class_logprob = calc_class_logprob(expected)
|
||||||
wordcounts =calc_word_count(in_f,expected)
|
wordcounts =calc_word_count(in_f,expected)
|
||||||
|
|
||||||
|
579158
train/expected.tsv
579158
train/expected.tsv
File diff suppressed because it is too large
Load Diff
289579
train/expected.tsv_
289579
train/expected.tsv_
File diff suppressed because it is too large
Load Diff
289579
train/expected.tsv_no
Normal file
289579
train/expected.tsv_no
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user