Skip to content

TimilsinaBimal/News-Article-Classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

News Article Classifier

Classify News Articles into different 14 categories. The data was taken from Kaggle which contained only title and categories so we Scraped that data to include article contents. The data can be found here: News Article Category Dataset

DataSet

The dataset contains mainly columns about, category, title and body. The category column contains the category the article, title contains the title of the article and body contains the contents of the article. There are total of 6877 data samples of 14 categories: ARTS & CULTURE, BUSINESS, COMEDY, CRIME, EDUCATION, ENTERTAINMENT, ENVIRONMENT, MEDIA, POLITICS, RELIGION, SCIENCE, SPORTS, TECH, WOMEN.

Model Accuracies

image

Selected Model: Logistic Regression
Model Accuracy (test): 79.57%

Logistic Regression

Confusion Matrix:

image

How to run the project

  1. Clone the repository into your local machine.
git clone https://github.com/TimilsinaBimal/News-Article-Classifier.git
  1. Inside Main Directory create a virtual environment.
python -m venv <venv_name>
  1. Install all the dependencies.
pip install -r requirements.txt
  1. Go to src/api/ and run
uvicorn main:app --reload
  1. Go to src/web/ and run into your local machine index.html file.
  2. Head to Chrome or any browser and go to your local server and follow the instructions
  3. To Run in CLI, Go to src/api/ and run
python make_predictions.py

Enjoy!