submission
This commit is contained in:
parent
b9c43ca1cc
commit
e0e8daf6f6
BIN
dev-0/in.tsv.xz
Normal file
BIN
dev-0/in.tsv.xz
Normal file
Binary file not shown.
6
run.py
6
run.py
@ -6,7 +6,7 @@ with open('train/in.tsv', 'r', encoding='utf-8') as f:
|
||||
x_train = pd.DataFrame([line.strip().split('\t') for line in f.readlines()], columns=['text', 'text_id'])
|
||||
with open('dev-0/in.tsv', 'r', encoding='utf-8') as f:
|
||||
x_dev = pd.DataFrame([line.strip().split('\t') for line in f.readlines()], columns=['text', 'text_id'])
|
||||
with open('train/in.tsv', 'r', encoding='utf-8') as f:
|
||||
with open('test-A/in.tsv', 'r', encoding='utf-8') as f:
|
||||
x_test = pd.DataFrame([line.strip().split('\t') for line in f.readlines()], columns=['text', 'text_id'])
|
||||
|
||||
y_train = pd.read_csv('train/expected.tsv', sep='\t', names=['paranormal'], encoding='utf-8')
|
||||
@ -19,13 +19,13 @@ mnb_model = MultinomialNB().fit(x_train_vectorized, y_train.values.ravel())
|
||||
# Dev data
|
||||
x_dev_prepared = tfidf_vectorizer.transform(x_dev['text'].values)
|
||||
predictions = mnb_model.predict(x_dev_prepared)
|
||||
with open('dev-0/out.tsv', 'w') as f:
|
||||
with open('dev-0/out.tsv', 'w', encoding='utf-8') as f:
|
||||
for pred in predictions:
|
||||
f.write(f'{pred}\n')
|
||||
|
||||
# Test data
|
||||
x_test_vectorized = tfidf_vectorizer.transform(x_test['text'].values)
|
||||
predictions = mnb_model.predict(x_test_vectorized)
|
||||
with open('test-A/out.tsv', 'w') as f:
|
||||
with open('test-A/out.tsv', 'w', encoding='utf-8') as f:
|
||||
for pred in predictions:
|
||||
f.write(f'{pred}\n')
|
||||
|
BIN
test-A/in.tsv.xz
Normal file
BIN
test-A/in.tsv.xz
Normal file
Binary file not shown.
285395
test-A/out.tsv
285395
test-A/out.tsv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user