Skip to content

aybstain/Text_classification_models

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Topic Classification with ML Models

This repository contains the code and data for a topic classification project using various Machine Learning (ML) models. The goal is to classify news articles into four categories: World, Sports, Business, and Sci/Tech.

Contents

  1. Overview
  2. Prerequisites
  3. Project Structure
  4. Data Preprocessing
  5. ML Models
  6. Confusion Matrix
  7. Usage
  8. License

Overview

In this project, we explore different ML models, including Random Forest, Naive Bayes, SVM, and CNN, for topic classification on a dataset of news articles. We compare their performance using accuracy and F1-score metrics.

Prerequisites

To run the code in this repository, you'll need the following Python libraries:

  • pandas
  • numpy
  • scikit-learn
  • nltk
  • keras
  • gradio

You can install these dependencies using pip:

Data Preprocessing

In the Jupyter notebook all_in_one.ipynb, we load and preprocess the news articles data. The preprocessing steps include tokenization, removing stop words, stemming, and converting the text data into sequences for feeding into the models.

ML Models

We explore four different ML models for topic classification:

  1. Random Forest
  2. Naive Bayes
  3. SVM
  4. CNN

Each model is trained on the preprocessed data and evaluated on the test set. We present the accuracy and the classification report that includes precision, recall, and F1-score for each class.

Confusion Matrix

We visualize the performance of each ML model using confusion matrices. The confusion matrix helps us to understand the model's predictions and identify areas of improvement.

Usage

Run the main.py script in your local environment or on your server. The script will start the Gradio app and provide a user interface for entering text. The Gradio app will display the predicted class on the screen

Results

Capture1 Capture Capture2 capture3

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published