# paiva-l/identificador-de-fake-news architecture

> Architecture diagram of the GitHub repository paiva-l/identificador-de-fake-news, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/paiva-l/identificador-de-fake-news
- Repository: https://github.com/paiva-l/identificador-de-fake-news

## Overview

This repository is an academic fake-news classifier for Portuguese news, developed through data preparation, model training and evaluation, and a Streamlit prediction interface. The main user workflow is to submit news text and receive a real/fake classification with a decision-margin estimate. The tree and README identify the notebook stages and artifacts; the sampled app source confirms its input, model-loading, prediction, and display behavior. Notebook internals and the precise training-to-artifact wiring were not sampled, so those links are limited to documented responsibilities.

Main entry points: [`notebooks/v2_pipeline_linearsvc/app.py`](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/app.py) (Streamlit classifier), [`notebooks/v2_pipeline_linearsvc/modelo_linearsvc_fakerecogna.joblib`](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/modelo_linearsvc_fakerecogna.joblib) (LinearSVC pipeline), [`data/FakeRecogna.xlsx`](https://github.com/paiva-l/identificador-de-fake-news/blob/main/data/FakeRecogna.xlsx) (Fake.br data), [`notebooks/v2_pipeline_linearsvc/01_preproc_eda.ipynb`](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/01_preproc_eda.ipynb) (Clean and explore)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_raw_data["Fake.br data<br/>[FakeRecogna.xlsx]"]
  node_cleaning["Clean and explore"]
  node_processed_data["Processed data<br/>[train.csv]"]
  node_holdout_data["Holdout data<br/>[test_holdout.csv]"]
  node_baseline_cleaning["Baseline cleaning"]
end

subgraph group_modeling["Model development"]
  node_training["Train and tune"]
  node_validation["External OOD validation"]
  node_model["LinearSVC pipeline"]
  node_baseline_training["Logistic regression"]
  node_benchmark["Model benchmark"]
  node_baseline_model["Baseline model"]
  node_metrics["Evaluation metrics"]
end

subgraph group_inference["News classification"]
  node_app["Streamlit classifier<br/>[app.py]"]
  node_prediction["Class and confidence<br/>[app.py]"]
end

node_reader(("News reader"))

node_raw_data -->|"analyzed and cleaned"| node_cleaning
node_cleaning -->|"prepares data"| node_processed_data
node_processed_data -->|"used for training"| node_training
node_training -->|"produces pipeline"| node_model
node_holdout_data -->|"used for validation"| node_validation
node_model -->|"evaluated by"| node_validation
node_raw_data -->|"analyzed and cleaned"| node_baseline_cleaning
node_baseline_cleaning -->|"prepares data"| node_baseline_training
node_baseline_training -->|"trains model"| node_baseline_model
node_baseline_model -->|"benchmarked by"| node_benchmark
node_benchmark -->|"reports results"| node_metrics
node_reader -->|"submits news text"| node_app
node_app -->|"loads and predicts with"| node_model
node_app -->|"displays classification"| node_prediction
node_app -->|"shows result"| node_reader

click node_raw_data "https://github.com/paiva-l/identificador-de-fake-news/blob/main/data/FakeRecogna.xlsx"
click node_cleaning "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/01_preproc_eda.ipynb"
click node_processed_data "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/data/processed/train.csv"
click node_holdout_data "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/data/processed/test_holdout.csv"
click node_training "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/02_treino_cv_gridsearch.ipynb"
click node_validation "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/03_validacao_externa_ood.ipynb"
click node_model "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/modelo_linearsvc_fakerecogna.joblib"
click node_baseline_cleaning "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v1_baseline/01_limpeza_eda_pln_fakerecogna.ipynb"
click node_baseline_training "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v1_baseline/02_treinamento_modelo_regressao_logistica.ipynb"
click node_benchmark "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v1_baseline/03-benchmark-de-modelos.ipynb"
click node_baseline_model "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v1_baseline/models/modelo_regressao_logistica.pkl"
click node_metrics "https://github.com/paiva-l/identificador-de-fake-news/blob/main/reports/metrics_regressao_logistica.json"
click node_app "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/app.py"
click node_prediction "https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/app.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_raw_data,node_cleaning,node_processed_data,node_holdout_data,node_baseline_cleaning toneBlue
class node_training,node_validation,node_model,node_baseline_training,node_benchmark,node_baseline_model,node_metrics toneAmber
class node_app,node_prediction toneMint
class node_reader toneIndigo
```

## Components

### Data preparation

- [Fake.br data](https://github.com/paiva-l/identificador-de-fake-news/blob/main/data/FakeRecogna.xlsx): `data/FakeRecogna.xlsx`
- [Clean and explore](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/01_preproc_eda.ipynb): `notebooks/v2_pipeline_linearsvc/01_preproc_eda.ipynb`
- [Processed data](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/data/processed/train.csv): `notebooks/v2_pipeline_linearsvc/data/processed/train.csv`
- [Holdout data](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/data/processed/test_holdout.csv): `notebooks/v2_pipeline_linearsvc/data/processed/test_holdout.csv`
- [Baseline cleaning](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v1_baseline/01_limpeza_eda_pln_fakerecogna.ipynb): `notebooks/v1_baseline/01_limpeza_eda_pln_fakerecogna.ipynb`

### Model development

- [Train and tune](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/02_treino_cv_gridsearch.ipynb): `notebooks/v2_pipeline_linearsvc/02_treino_cv_gridsearch.ipynb`
- [External OOD validation](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/03_validacao_externa_ood.ipynb): `notebooks/v2_pipeline_linearsvc/03_validacao_externa_ood.ipynb`
- [LinearSVC pipeline](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/modelo_linearsvc_fakerecogna.joblib): `notebooks/v2_pipeline_linearsvc/modelo_linearsvc_fakerecogna.joblib`
- [Logistic regression](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v1_baseline/02_treinamento_modelo_regressao_logistica.ipynb): `notebooks/v1_baseline/02_treinamento_modelo_regressao_logistica.ipynb`
- [Model benchmark](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v1_baseline/03-benchmark-de-modelos.ipynb): `notebooks/v1_baseline/03-benchmark-de-modelos.ipynb`
- [Baseline model](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v1_baseline/models/modelo_regressao_logistica.pkl): `notebooks/v1_baseline/models/modelo_regressao_logistica.pkl`
- [Evaluation metrics](https://github.com/paiva-l/identificador-de-fake-news/blob/main/reports/metrics_regressao_logistica.json): `reports/metrics_regressao_logistica.json`

### News classification

- [Streamlit classifier](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/app.py): `notebooks/v2_pipeline_linearsvc/app.py`
- [Class and confidence](https://github.com/paiva-l/identificador-de-fake-news/blob/main/notebooks/v2_pipeline_linearsvc/app.py): `notebooks/v2_pipeline_linearsvc/app.py`

### Other components

- **News reader**

## Connections

- Fake.br data → Clean and explore: analyzed and cleaned
- Clean and explore → Processed data: prepares data
- Processed data → Train and tune: used for training
- Train and tune → LinearSVC pipeline: produces pipeline
- Holdout data → External OOD validation: used for validation
- LinearSVC pipeline → External OOD validation: evaluated by
- Fake.br data → Baseline cleaning: analyzed and cleaned
- Baseline cleaning → Logistic regression: prepares data
- Logistic regression → Baseline model: trains model
- Baseline model → Model benchmark: benchmarked by
- Model benchmark → Evaluation metrics: reports results
- News reader → Streamlit classifier: submits news text
- Streamlit classifier → LinearSVC pipeline: loads and predicts with
- Streamlit classifier → Class and confidence: displays classification
- Streamlit classifier → News reader: shows result
