Skip to content

KPlanisphere/text-classification-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Text Classification Model

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.

Features

  • 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).

Requirements

  • Python 3.x
  • Libraries:
    • NumPy
    • Keras
    • TensorFlow
    • NLTK

How to Run

  1. Clone the repository.
    git clone https://github.com/KPlanisphere/text-classification-model.git
    cd text-classification-model
  2. Install dependencies.
    pip install -r requirements.txt
  3. Place the dataset in the appropriate folders (NEGATIVO and POSITIVO).
  4. Run the script.
    python lab10.py

File Structure

  • 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.

Results

After training, the script will output the model's accuracy on the test set. The trained model's structure is saved as model.png.