Skip to content

Commit

Permalink
Removing unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaloney111 committed Apr 14, 2024
1 parent 890c991 commit b346555
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 28 deletions.
6 changes: 0 additions & 6 deletions api/NbEmotionsModel.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import pandas as pd
import pickle

# bag of words
from sklearn.feature_extraction.text import TfidfVectorizer

#tfidf_vectorizer = TfidfVectorizer(use_idf=True)

def make_prediction(my_sentence):
model_file = "./models/emotions_pipeline.pkl"
try:
Expand Down
16 changes: 0 additions & 16 deletions api/NbLinRegressionModel.py

This file was deleted.

1 change: 0 additions & 1 deletion api/NbNewsModel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pandas as pd
import pickle

def news_prediction(texts):
Expand Down
Binary file added api/models/OIGENTE
Binary file not shown.
9 changes: 6 additions & 3 deletions api/models_code/nb_emotions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import pandas as pd
import pickle
from sklearn.pipeline import make_pipeline
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer

# bag of words
from sklearn.feature_extraction.text import TfidfVectorizer
Expand All @@ -11,7 +9,12 @@
from sklearn.naive_bayes import MultinomialNB

df = pd.read_csv('../training_df/tweet_emotions.csv')
train_data, test_data, train_target, test_target = train_test_split(df["content"], df["sentiment"], test_size=0.2, shuffle=True)

# Dividindo os dados em um conjunto de treinamento e um conjunto de teste
x = df['content']
y = df['sentiment']

train_data, test_data, train_target, test_target = train_test_split(x, y, test_size=0.2, shuffle=True)

# Criando um pipeline com o vetorizador TF-IDF e o classificador Multinomial Naive Bayes
pipeline = make_pipeline(TfidfVectorizer(), MultinomialNB())
Expand Down
6 changes: 4 additions & 2 deletions api/models_code/nb_news.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import pandas as pd
import pickle
from sklearn.pipeline import make_pipeline
from sklearn.feature_extraction.text import CountVectorizer

# bag of words
from sklearn.feature_extraction.text import TfidfVectorizer

from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import MultinomialNB

df = pd.read_csv("../training_df/nb_news.csv")

# Dividindo os dados em um conjunto de treinamento e um conjunto de teste
x = df['short_description']
y = df['category']

X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=42)
# Criando um pipeline que inclui o vetorizador TF-IDF e o modelo Naive Bayes

# Criando um pipeline com o vetorizador TF-IDF e o classificador Multinomial Naive Bayes
pipeline = make_pipeline(TfidfVectorizer(), MultinomialNB())
Expand Down
24 changes: 24 additions & 0 deletions api/requirements.txt.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<<<<<<< Updated upstream:api/requirements.txt
Flask==2.3.2
Flask-Cors==4.0.0
pandas==2.0.3
nltk==3.8.1
scikit-learn==1.3.0
numpy==1.25.2
matplotlib==3.7.1
seaborn==0.13.0
tensorflow==2.16.1
keras==3.0.0
=======
Flask==2.3.2
Flask-Cors==4.0.0
pandas==2.0.3
nltk==3.8.1
scikit-learn==1.3.0
numpy==1.25.2
matplotlib==3.7.1
seaborn==0.13.0
tensorflow==2.16.1
keras==3.0.0
torchtext==0.17.2
>>>>>>> Stashed changes:requirements.txt

0 comments on commit b346555

Please sign in to comment.