Skip to content

Latest commit

 

History

History
11 lines (6 loc) · 1017 Bytes

README.md

File metadata and controls

11 lines (6 loc) · 1017 Bytes

Here's a breakdown of the key components in the code:

Data Loading: The code loads a dataset from a CSV file containing news articles and their corresponding labels (fake or real).

Text Preprocessing: It preprocesses the text data using TF-IDF vectorization, which converts the raw text into numerical features that can be used by machine learning algorithms.

Model Training: The Passive Aggressive Classifier is trained on the TF-IDF transformed training data. This classifier is known for its ability to perform well in online learning scenarios, making it suitable for text classification tasks.

Model Evaluation: The trained model is used to make predictions on the test data, and its accuracy is evaluated using the accuracy score. Additionally, a confusion matrix is generated to visualize the classifier's performance in distinguishing between fake and real news articles.

Overall, this code demonstrates a simple yet effective approach to building a fake news detector using machine learning techniques.