raport addeed
This commit is contained in:
parent
5d917fcffa
commit
e3855d5411
1
.~lock.Raport.docx#
Normal file
1
.~lock.Raport.docx#
Normal file
@ -0,0 +1 @@
|
|||||||
|
,tomasz,tomasz-HP-EliteBook-8570p,06.07.2021 12:52,file:///home/tomasz/.config/libreoffice/4;
|
BIN
Raport.docx
BIN
Raport.docx
Binary file not shown.
BIN
Raport.pdf
Normal file
BIN
Raport.pdf
Normal file
Binary file not shown.
33
svm.py
Normal file
33
svm.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import pandas as pd
|
||||||
|
import numpy as np
|
||||||
|
from nltk.tokenize import word_tokenize
|
||||||
|
from nltk import pos_tag
|
||||||
|
from nltk.corpus import stopwords
|
||||||
|
from nltk.stem import WordNetLemmatizer
|
||||||
|
from sklearn.preprocessing import LabelEncoder
|
||||||
|
from collections import defaultdict
|
||||||
|
from nltk.corpus import wordnet as wn
|
||||||
|
from sklearn.feature_extraction.text import TfidfVectorizer
|
||||||
|
from sklearn import model_selection, naive_bayes, svm
|
||||||
|
from sklearn.metrics import accuracy_score
|
||||||
|
from sklearn.pipeline import make_pipeline
|
||||||
|
|
||||||
|
with open("train/in.tsv") as f:
|
||||||
|
x_train = f.readlines()
|
||||||
|
|
||||||
|
with open("train/expected.tsv") as f:
|
||||||
|
y_train = f.readlines()
|
||||||
|
|
||||||
|
with open("dev-0/in.tsv") as f:
|
||||||
|
x_dev = f.readlines()
|
||||||
|
|
||||||
|
y_train = LabelEncoder().fit_transform(y_train)
|
||||||
|
y_train
|
||||||
|
|
||||||
|
pipeline = make_pipeline(TfidfVectorizer(),svm.SVC())
|
||||||
|
|
||||||
|
model = pipeline.fit(x_train, y_train)
|
||||||
|
|
||||||
|
prediction = model.predict(x_dev)
|
||||||
|
|
||||||
|
np.savetxt("svm/out.tsv", prediction, fmt='%d')
|
514
svm/out.tsv
514
svm/out.tsv
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
14
wyniki.txt
14
wyniki.txt
@ -1,14 +1,20 @@
|
|||||||
Bayes:
|
Bayes:
|
||||||
Likelihood 0.0000
|
Likelihood 0.0000
|
||||||
Accuracy 0.7367
|
Accuracy 0.7367
|
||||||
F1.0 0.4367
|
F1.0 0.4367
|
||||||
Precision 0.8997
|
Precision 0.8997
|
||||||
Recall 0.2883
|
Recall 0.2883
|
||||||
|
|
||||||
Logistic Regression:
|
Logistic Regression:
|
||||||
Likelihood 0.0000
|
Likelihood 0.0000
|
||||||
Accuracy 0.7523
|
Accuracy 0.7523
|
||||||
F1.0 0.6143
|
F1.0 0.6143
|
||||||
Precision 0.6842
|
Precision 0.6842
|
||||||
Recall 0.5573
|
Recall 0.5573
|
||||||
|
|
||||||
|
SVM:
|
||||||
|
Likelihood 0.0000
|
||||||
|
Accuracy 0.8249
|
||||||
|
F1.0 0.7355
|
||||||
|
Precision 0.7905
|
||||||
|
Recall 0.6876
|
||||||
|
Loading…
Reference in New Issue
Block a user