# salahmdk/decisiontree_python architecture

> Architecture diagram of the GitHub repository salahmdk/decisiontree_python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/salahmdk/decisiontree_python
- Repository: https://github.com/salahmdk/decisiontree_python

## Overview

##### Project Type and Core Purpose
- This is a data science / machine learning project focused on analyzing historical football match statistics to predict match outcomes.
- The key functionalities include data ingestion (reading CSV files), data selection/preparation, model training using a decision tree classifier, and model visualization.

##### Key Components
a. Data Input Layer:
- Data Sources: Two CSV files (“Vainqueurs des matchs de football clean.csv” and “Vainqueurs des matchs de football non clean.csv”).
- Representation: Use a component labeled “Data Files (CSV)” showing the raw match data.

b. Data Processing & Preparation:
- Module: The use of pandas for reading and manipulating data.
- Elements: Loading data (pd.read_csv), selecting the relevant columns such as ‘gf’, ‘ga’, ‘venue_code’, ‘opp_code’, ‘hour’, and ‘day_code’.
- Representation: Label a block “Data Preprocessing” that takes input from the Data Files.

c. Model Training:
- Module: Scikit-learn (sklearn).
- Elements: Configuration of the DecisionTreeClassifier (max_depth=5), splitting data into training and testing sets (train_test_split), and training the model.
- Representation: Create a “Model Training” component that consumes the preprocessed data and outputs the trained decision tree model.

d. Model Visualization:
- Module: matplotlib combined with sklearn’s plot_tree function.
- Elements: Code for setting the figure size, plotting the decision tree, labeling features and classes, and saving the visual output to “football_decision_tree.png.”
- Representation: Include a “Visualization” component that takes the trained model, generates the decision tree image, and displays/saves it.

e. Documentation and Deployment:
- Mention that the project is documented via a README and was imported to GitHub.

##### Relationships and Data Flow
- Additionally, drawing a separate line from the entire flow to a “GitHub” block can indicate version control and code sharing.

##### Architectural Patterns and Design Principles
- The system follows a linear workflow typical for machine learning projects: Data Ingestion → Data Processing → Model Training → Visualization.
- It adopts a modular approach: Each step is clearly separated for data handling, model creation, and result visualization.
- Clarity and traceability; that is exactly why the decision tree visualization plays a significant interpretive role.

##### Relevant Technologies
- pandas for data manipulation.
- scikit-learn for training the decision tree.
- matplotlib for creating the final visual output.
- Python as the programming language for orchestrating these components.
- GitHub for versioning and collaboration/documentation.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data Input – CSV Files"
        DF1["Vainqueurs des matchs de football clean.csv"]:::csv
        DF2["Vainqueurs des matchs de football non clean.csv"]:::csv
    end

    DP["Data Preprocessing – pandas"]:::preprocess
    MT["Model Training – Decision Tree (sklearn)"]:::training
    MV["Visualization – matplotlib"]:::visualize
    DD["Documentation & Deployment"]:::doc

    DF1 --> DP
    DF2 --> DP
    DP --> MT
    MT --> MV
    MV --> DD

    click DF1 "https://github.com/salahmdk/decisiontree_python/blob/main/Vainqueurs des matchs de football clean.csv"
    click DF2 "https://github.com/salahmdk/decisiontree_python/blob/main/Vainqueurs des matchs de football non clean.csv"
    click DP "https://github.com/salahmdk/decisiontree_python/blob/main/decision_tree_football.py"
    click MT "https://github.com/salahmdk/decisiontree_python/blob/main/decision_tree_football.py"
    click MV "https://github.com/salahmdk/decisiontree_python/blob/main/decision_tree_football.py"
    click DD "https://github.com/salahmdk/decisiontree_python/blob/main/README.md"

    classDef csv fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef preprocess fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef training fill:#ffa500,stroke:#333,stroke-width:2px;
    classDef visualize fill:#ffd700,stroke:#333,stroke-width:2px;
    classDef doc fill:#d3d3d3,stroke:#333,stroke-width:2px;
```
