How danielverdidoamarante/churn works
Main Components
• Data Input: Represent the "data" directory as the source of raw CSV files (e.g., Abandono_clientes.csv for training and Abandono_teste.csv for predictions).
• Exploratory Data Analysis (EDA): Represent the "EDA.ipynb" notebook which performs initial data exploration, visualizations, and descriptive statistics.
• Data Preprocessing: Show the "preprocess.py" component that handles data cleaning and transformation (such as detecting CSV delimiters and converting categorical variables).
• Model Training: Include both "train_models.py" and "train.py" which are responsible for training various models (with the Random Forest algorithm highlighted) and saving the trained model.
• Prediction: Illustrate "predict.py" that loads the saved model, runs predictions on new data, and writes results.
• Output Generation: Represent the "output" directory where the prediction results (CSV file) are saved.
Relationships and Interactions
• The output of Preprocessing is then fed into the Model Training component.
• Post training, the trained model is saved to the Model Storage area.
• For generating new predictions, the Prediction component reads both the new data (from the Data directory) and the saved model, ultimately outputting predictions to the Output directory.
Architectural Patterns & Design Principles
• Pipeline Architecture: A sequential flow from data ingestion to preprocessing to training to inference.
• Separation of Concerns: Each component (EDA, preprocessing, training, prediction) serves a distinct role.
• Modularity: Components such as preprocessing and model training can be developed, tested, and maintained independently.
• Use of dependency injection is implicit – for example, prediction scripts rely on models saved via joblib; reusing components (like preprocessing methods) can be indicated if needed.
Technologies, Frameworks, and Libraries
• pandas: For data manipulation in both preprocessing and EDA.
• scikit-learn: For machine learning model training (Random Forest and potentially other classifiers in train_models.py).
• joblib: For saving and loading the trained models stored in the models directory.
• matplotlib and seaborn: For data visualization in the EDA.ipynb notebook.
• Python scripts: All critical sections are implemented as Python scripts, emphasizing a scripting-based data science workflow.