GithubHelp home page GithubHelp logo

toannguyenkhanh / ag-news-text-classification Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 16.98 MB

This repository is dedicated to the task of text classification using the AG-News dataset.

Python 0.01% HTML 0.03% Jupyter Notebook 99.97%
keras ne nltk python sklearn text-classification

ag-news-text-classification's Introduction

AG News Text Classification

This repository contains code for text classification on the AG News dataset using various machine learning and deep learning techniques. The AG News dataset is a collection of news articles categorized into four classes: World, Sports, Business, and Science/Technology.

Demo video

Result

Dataset

The AG News dataset consists of 120,000 training samples and 7,600 test samples, evenly distributed among the four classes. Each sample is a short news article accompanied by a title.

You can download the dataset from here.

Dependencies

  • Python
  • NumPy
  • Pandas
  • Scikit-learn
  • TensorFlow (for deep learning models)

Models

This repository includes implementations of the following models:

  • Multinomial Naive Bayes
  • SGD (Stochastic Gradient Descent)
  • Convolutional Neural Network (CNN)

Usage

All the necessary steps for data preparation, preprocessing, and model training are contained within the Jupyter Notebook provided.

  1. Data Preparation: Download the AG News dataset and place it in the data directory within the same directory as the notebook. If you're using a different dataset, make sure it follows the same format or preprocess accordingly.

  2. Preprocessing: Execute the preprocessing cells in the notebook. These cells will tokenize the text, remove stopwords, and convert the labels into numerical format.

  3. Model Training (Optional): If you want to train your own models, execute the training cells in the notebook. You can use the provided scripts or your custom implementations to train the models.

    • Ensure that you have the necessary dependencies installed in your Jupyter environment.
  4. Prediction App: Use the provided prediction app to classify news articles. Here's how to run the app:

    • Ensure that you have the necessary dependencies installed.

    • Run the prediction app using the following command:

      python app.py
      
    • The app will prompt you to input the text of a news article. Enter the text and press enter.

    • The app will then predict the category of the news article based on the trained model.

  5. Evaluation: If you want to evaluate the performance of the trained models, execute the evaluation cells in the notebook. This will output accuracy and other evaluation metrics.

  6. Demo

Demo Screenshot Demo Screenshot Demo Screenshot

Contributing

Contributions are welcome! If you have ideas for improvements or new features, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.