ML/AINLPMultilingualResearchMarch - May 2024

Fake News Origin Detection

NLP-based machine learning system for detecting the origins and propagation patterns of misinformation, achieving 96.3% accuracy using linguistic feature analysis and source credibility scoring.

96.3%

Details

This project built a machine learning system that goes beyond simple fake news detection to identify the origins and propagation patterns of misinformation. While most fake news detectors classify individual articles as true or false, this system traces misinformation back to its source by analyzing linguistic fingerprints, writing style patterns, and source credibility signals.

The system employs a multi-stage NLP pipeline: text preprocessing with NLTK for tokenization and normalization, TF-IDF vectorization for content representation, linguistic feature extraction capturing stylometric patterns (sentence complexity, vocabulary richness, punctuation usage), and source credibility scoring based on domain reputation and historical accuracy.

Multiple classifiers were evaluated including logistic regression, random forest, gradient boosting, and SVM. The final system uses an optimized ensemble approach achieving 96.3% accuracy on the test set. Feature importance analysis revealed that linguistic style features and source credibility signals were more predictive than content-based features alone, suggesting that how misinformation is written matters as much as what it says.

Highlights

  • 96.3% accuracy in detecting fake news origins and propagation patterns
  • Multi-stage NLP pipeline: preprocessing, TF-IDF, linguistic features, source credibility
  • Stylometric analysis capturing writing patterns, vocabulary richness, and complexity metrics
  • Source credibility scoring based on domain reputation and historical accuracy
  • Feature importance analysis revealing linguistic style as more predictive than content alone
  • Ensemble classifier outperforming individual models across all metrics

Code sample

origin_detector.py
python
class FakeNewsOriginDetector:
    """Traces misinformation origins via linguistic fingerprinting."""

    def __init__(self):
        self.tfidf = TfidfVectorizer(max_features=5000, ngram_range=(1, 3))
        self.classifier = GradientBoostingClassifier(n_estimators=200)

    def extract_features(self, text: str) -> np.ndarray:
        content = self.tfidf.transform([text]).toarray()
        linguistic = np.array([
            flesch_reading_ease(text),
            vocabulary_richness(text),
            avg_sentence_length(text),
            punctuation_density(text),
            hedging_word_frequency(text),
        ])
        credibility = self.score_source_credibility(text)
        return np.concatenate([content[0], linguistic, [credibility]])

    def predict_origin(self, article: str) -> OriginResult:
        features = self.extract_features(article)
        prediction = self.classifier.predict_proba([features])[0]
        return OriginResult(
            is_fake=prediction[1] > 0.5,
            confidence=max(prediction),
            source_pattern=self.trace_propagation(article),
        )

Built with

PythonNLPScikit-learnNLTKTF-IDFFeature Engineering