# marcosabp/projeto-am-2026-2 architecture

> Architecture diagram of the GitHub repository marcosabp/projeto-am-2026-2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marcosabp/projeto-am-2026-2
- Repository: https://github.com/marcosabp/projeto-am-2026-2

## Overview

This repository contains two independent experiments on the Spambase dataset. Q1 explores joint clustering of observations and features, selects a partition, and reports visual and external-quality diagnostics. Q2 compares four classifiers using repeated stratified outer folds and inner hyperparameter selection, then summarizes and saves fold results. The sampled sources establish these workflows and core model behavior; unsampled modules are represented only where the tree or sampled callers support their role.

Main entry points: [`src/q2/utils/k_folds.py`](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/utils/k_folds.py) (Inner model selection), [`src/q1/main.py`](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q1/main.py) (Clustering runner), [`src/q2/main.py`](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/main.py) (Classification runner), [`src/q1/plots.py`](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q1/plots.py) (Plots and summary)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_q1_cluster["Q1 Clustering"]
  node_q1_main["Clustering runner<br/>[main.py]"]
  node_double_kmeans["Double K-Means<br/>[double_kmeans.py]"]
end

subgraph group_q1_analysis["Q1 Analysis"]
  node_pair_eval["Partition evaluation<br/>[double_kmeans.py]"]
  node_q1_plots["Plots and summary<br/>[plots.py]"]
end

subgraph group_q2_evaluation["Q2 Evaluation"]
  node_q2_main["Classification runner<br/>[main.py]"]
  node_ext_cv["Outer cross-validation<br/>[k_folds.py]"]
  node_int_cv["Inner model selection<br/>[k_folds.py]"]
  node_metrics["Metrics and summaries<br/>[metrics.py]"]
end

subgraph group_q2_models["Q2 Classifiers"]
  node_gaussian["Gaussian Bayes<br/>[gauss_bayes.py]"]
  node_knn["KNN Bayes<br/>[knn_bayes.py]"]
  node_parzen["Parzen Bayes<br/>[parzen_bayes.py]"]
  node_logistic["Logistic regression"]
end

node_data["Spambase files"]
node_sklearn["scikit-learn"]
node_q1_figures["Q1 figures"]
node_q2_results["Q2 result files"]

node_data -->|"provides data"| node_q1_main
node_q1_main -->|"fits partitions"| node_double_kmeans
node_q1_main -->|"evaluates pairs"| node_pair_eval
node_q1_main -->|"requests plots"| node_q1_plots
node_q1_plots -->|"writes figures"| node_q1_figures
node_data -->|"provides data"| node_q2_main
node_q2_main -->|"runs evaluation"| node_ext_cv
node_q2_main -->|"summarizes results"| node_metrics
node_q2_main -->|"writes results"| node_q2_results
node_ext_cv -->|"selects parameters"| node_int_cv
node_ext_cv -->|"scores predictions"| node_metrics
node_int_cv -->|"fits and predicts"| node_gaussian
node_int_cv -->|"fits and predicts"| node_knn
node_int_cv -->|"fits and predicts"| node_parzen
node_int_cv -->|"fits and predicts"| node_logistic
node_ext_cv -->|"scales folds"| node_sklearn
node_logistic -->|"uses estimator"| node_sklearn

click node_q1_main "https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q1/main.py"
click node_double_kmeans "https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q1/double_kmeans.py"
click node_pair_eval "https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q1/double_kmeans.py"
click node_q1_plots "https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q1/plots.py"
click node_q2_main "https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/main.py"
click node_ext_cv "https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/utils/k_folds.py"
click node_int_cv "https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/utils/k_folds.py"
click node_metrics "https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/utils/metrics.py"
click node_gaussian "https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/models/gauss_bayes.py"
click node_knn "https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/models/knn_bayes.py"
click node_parzen "https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/models/parzen_bayes.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_q1_main,node_double_kmeans toneBlue
class node_pair_eval,node_q1_plots toneAmber
class node_q2_main,node_ext_cv,node_int_cv,node_metrics toneMint
class node_gaussian,node_knn,node_parzen,node_logistic toneRose
class node_data,node_sklearn,node_q1_figures,node_q2_results toneIndigo
```

## Components

### Q1 Clustering

- [Clustering runner](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q1/main.py): `src/q1/main.py`
- [Double K-Means](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q1/double_kmeans.py): `src/q1/double_kmeans.py`

### Q1 Analysis

- [Partition evaluation](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q1/double_kmeans.py): `src/q1/double_kmeans.py`
- [Plots and summary](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q1/plots.py): `src/q1/plots.py`

### Q2 Evaluation

- [Classification runner](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/main.py): `src/q2/main.py`
- [Outer cross-validation](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/utils/k_folds.py): `src/q2/utils/k_folds.py`
- [Inner model selection](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/utils/k_folds.py): `src/q2/utils/k_folds.py`
- [Metrics and summaries](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/utils/metrics.py): `src/q2/utils/metrics.py`

### Q2 Classifiers

- [Gaussian Bayes](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/models/gauss_bayes.py): `src/q2/models/gauss_bayes.py`
- [KNN Bayes](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/models/knn_bayes.py): `src/q2/models/knn_bayes.py`
- [Parzen Bayes](https://github.com/marcosabp/projeto-am-2026-2/blob/main/src/q2/models/parzen_bayes.py): `src/q2/models/parzen_bayes.py`
- **Logistic regression**

### Other components

- **Spambase files**
- **scikit-learn**
- **Q1 figures**
- **Q2 result files**

## Connections

- Spambase files → Clustering runner: provides data
- Clustering runner → Double K-Means: fits partitions
- Clustering runner → Partition evaluation: evaluates pairs
- Clustering runner → Plots and summary: requests plots
- Plots and summary → Q1 figures: writes figures
- Spambase files → Classification runner: provides data
- Classification runner → Outer cross-validation: runs evaluation
- Classification runner → Metrics and summaries: summarizes results
- Classification runner → Q2 result files: writes results
- Outer cross-validation → Inner model selection: selects parameters
- Outer cross-validation → Metrics and summaries: scores predictions
- Inner model selection → Gaussian Bayes: fits and predicts
- Inner model selection → KNN Bayes: fits and predicts
- Inner model selection → Parzen Bayes: fits and predicts
- Inner model selection → Logistic regression: fits and predicts
- Outer cross-validation → scikit-learn: scales folds
- Logistic regression → scikit-learn: uses estimator
