Skip to content

Commit

Permalink
Novas mundanças
Browse files Browse the repository at this point in the history
  • Loading branch information
vdhug committed Mar 9, 2018
1 parent cc2b494 commit 1aace8d
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 14 deletions.
38 changes: 38 additions & 0 deletions develop/tf-idf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,41 @@


print(accuracy_score(y_test, predicoes))






































22 changes: 14 additions & 8 deletions tcc/hoteis-reviews-tf-idf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
precisaoRL = []
f1RL = []


aux = []

for classe in y:
aux.append(classe)

for i in range(0, 10):
vectors = vectorizer.fit_transform(X)
from sklearn.model_selection import train_test_split
Expand Down Expand Up @@ -115,17 +121,17 @@
f1RL.append(f1_score(y_test, y_pred, average=None))

for i in range(0, 200):
obj = X[i]
obj = X[0]
X.remove(obj)
X.append(obj)

aux = y[i]
y.remove(aux)
y.append(aux)



obj = aux[0]
aux.remove(obj)
aux.append(obj)

y = []
for classe in aux:
y.append(classe)

# -----------------------------------------FINAL DA VALIDAÇÃO CRUZADA----------------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -235,4 +241,4 @@
for i in precisaoRL:
neg += float(i[0])
pos += float(i[1])
print("POS = ", pos/10, "NEG=", neg/10)
print("POS = ", pos/10, "NEG=", neg/10)
20 changes: 14 additions & 6 deletions tcc/moview-reviews-tf-idf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,15 @@
precisaoRL = []
f1RL = []

aux = []

for classe in y:
aux.append(classe)


for i in range(0, 10):
vectors = vectorizer.fit_transform(X)

from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(vectors, y, test_size=0.1, random_state=None, shuffle=False)
Expand Down Expand Up @@ -80,16 +87,17 @@
f1RL.append(f1_score(y_test, y_pred, average=None))

for i in range(0, 200):
obj = X[i]
obj = X[0]
X.remove(obj)
X.append(obj)

aux = y[i]
y.remove(aux)
y.append(aux)


obj = aux[0]
aux.remove(obj)
aux.append(obj)

y = []
for classe in aux:
y.append(classe)


# -----------------------------------------FINAL DA VALIDAÇÃO CRUZADA----------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 1aace8d

Please sign in to comment.