How krishnaik06/mlprojecthindi works
Purpose and Entry Points
This is an end-to-end Python ML project for student-performance prediction, covering dataset ingestion, feature preparation, model training/evaluation, experiment tracking, and inference. Primary runnable entry points are main.py and app.py; orchestration logic is organized under src/mlproject/pipelines/training_pipeline.py and src/mlproject/pipelines/prediction_pipeline.py.
Training Orchestration
The training pipeline coordinates the sequential ML lifecycle: acquire data, transform it, fit/select a model, and persist outputs. Its core boundary is between reusable pipeline orchestration and stage implementations:
• src/mlproject/pipelines/training_pipeline.py
• src/mlproject/components/data_ingestion.py
• src/mlproject/components/model_tranier.py
Data Ingestion and Versioned Dataset Boundary
Ingestion produces local train/test CSV artifacts from the raw dataset. DVC tracks the raw input rather than embedding its content in Git, making artifacts/raw.csv.dvc the dataset-version reference. Generated datasets are materialized under artifacts/.
• src/mlproject/components/data_ingestion.py
• artifacts/raw.csv.dvc
• artifacts/train.csv
Feature Transformation and Artifact Contract
The transformation stage prepares raw tabular records for training and prediction and serializes the fitted preprocessing state. The saved preprocessor is a compatibility contract: serving must apply the same object used during model fitting.
• src/mlproject/components/data_transformation.py
• artifacts/preprocessor.pkl
• src/mlproject/pipelines/prediction_pipeline.py
Model Training, Evaluation, and Persistence
Model training consumes transformed train/test data, evaluates regression quality, and writes the selected model artifact. CatBoost training outputs indicate CatBoost is a material model runtime/dependency. The inference path should load the paired model and preprocessor from artifacts/.
• src/mlproject/components/model_tranier.py
• artifacts/model.pkl
• catboost_info/catboost_training.json
Prediction / Application Boundary
The prediction pipeline isolates artifact loading and scoring from model development. app.py is the likely user-facing serving entry point, while main.py likely invokes the packaged training workflow; both sit above pipeline modules rather than directly owning preprocessing or model logic.
• app.py
• main.py
• src/mlproject/pipelines/prediction_pipeline.py
Experiment Tracking and Monitoring
MLflow records run metadata, regression metrics (MAE, R², RMSE), and serialized model packages under local mlruns/. The README also configures an external MLflow tracking URI hosted by DagsHub, so training can be redirected from local filesystem tracking to that remote service. A monitoring component exists as a separate lifecycle concern.
• src/mlproject/components/model_monitering.py
• mlruns/0/3c40c261ea9f4847a3e7044072cd205c/metrics/rmse
• mlruns/0/3c40c261ea9f4847a3e7044072cd205c/artifacts/model/MLmodel
Packaging and Runtime
The project is packaged as mlproject using a src/ layout. It runs in Python, with dependency declarations and a Docker build definition supporting reproducible execution. Notebooks are exploratory/training-history assets, separate from the production pipeline.
• setup.py
• requirements.txt
• Dockerfile
Main entry points: model_tranier.py Model Training · training_pipeline.py Training Pipeline · data_transformation.py Data Transformation · preprocessor.pkl Fitted Preprocessor
Components 17
Entry Points
- Training CLI · Starts the packaged training workflow.
main.py - Serving App · User-facing prediction entry point.
app.py
ML Workflow
- Training Pipeline · Coordinates ingestion, transformation, and model selection.
src/mlproject/pipelines/training_pipeline.py - Prediction Pipeline · Loads paired artifacts and scores records.
src/mlproject/pipelines/prediction_pipeline.py - Data Ingestion · Materializes local train/test data from the versioned raw dataset.
src/mlproject/components/data_ingestion.py - Data Transformation · Fits and applies tabular preprocessing.
src/mlproject/components/data_transformation.py - Model Training · Evaluates candidates and persists the selected regressor.
src/mlproject/components/model_tranier.py - Model Monitoring
src/mlproject/components/model_monitering.py
Data, Artifacts & Tracking
- Versioned Raw Dataset · Raw input is versioned outside Git content.
artifacts/raw.csv.dvc - Materialized Train Data
artifacts/train.csv - Fitted Preprocessor · Compatibility contract shared by training and serving.
artifacts/preprocessor.pkl - Selected Model
artifacts/model.pkl - CatBoost Training Output
catboost_info/catboost_training.json - MLflow Tracking · Records metrics and model packages locally or via configured remote tracking.
mlruns/0/3c40c261ea9f4847a3e7044072cd205c/metrics/rmse
Packaging & Runtime
- mlproject Package · src-layout project package.
setup.py - Python Dependencies · Includes the ML runtime dependencies.
requirements.txt - Container Build · Reproducible execution environment.
Dockerfile
Connections 19
- Training CLI → Training Pipeline: starts
- Serving App → Prediction Pipeline: serves through
- Training Pipeline → Data Ingestion: acquires data
- Training Pipeline → Data Transformation: prepares features
- Training Pipeline → Model Training: fits and selects
- Versioned Raw Dataset → Data Ingestion: versions raw input
- Data Ingestion → Materialized Train Data: materializes
- Materialized Train Data → Data Transformation: input records
- Data Transformation → Fitted Preprocessor: serializes
- Data Transformation → Model Training: transformed data
- Fitted Preprocessor → Model Training: fitted feature contract
- Model Training → Selected Model: persists selected model
- Model Training → CatBoost Training Output: emits training output
- Model Training → MLflow Tracking: logs metrics and model
- MLflow Tracking → Model Monitoring: run data
- Selected Model → Prediction Pipeline: loads
- Fitted Preprocessor → Prediction Pipeline: loads
- Python Dependencies → mlproject Package: installs runtime
- Container Build → mlproject Package: packages execution