This repository contains a Python project for binary text classification using a feedforward neural network. The model is implemented using the Keras library and processes text data to classify it into two categories: positive and negative.
- Data preprocessing:
- Text cleaning and tokenization.
- Removal of punctuation and stopwords.
- Conversion of text data to frequency-based matrices.
- Neural network:
- Input layer with 50 neurons and ReLU activation.
- Output layer with sigmoid activation for binary classification.
- Optimized with the Adam optimizer.
- Visualized model architecture as an image (
model.png
).
- Python 3.x
- Libraries:
- NumPy
- Keras
- TensorFlow
- NLTK
- Clone the repository.
git clone https://github.com/KPlanisphere/text-classification-model.git cd text-classification-model
- Install dependencies.
pip install -r requirements.txt
- Place the dataset in the appropriate folders (
NEGATIVO
andPOSITIVO
). - Run the script.
python lab10.py
lab10.py
: Main script for training and evaluating the model.vocabulario.py
: Script to manage vocabulary processing.vocabulario.txt
: Contains the vocabulary used in the dataset.
After training, the script will output the model's accuracy on the test set. The trained model's structure is saved as model.png
.