ishworrsubedii / ml_project_file_structure_template

While doing machine learning projects, managing code in a structured way is very crucial, so this repository contains a template for structuring a Python project. which I follow while doing the machine learning projects.

Repository from Github https://github.comishworrsubedii/ml_project_file_structure_templateRepository from Github https://github.comishworrsubedii/ml_project_file_structure_template

Project Structure

While doing machine learning projects, managing code in a structured way is very crucial, so this repository contains a template for structuring a Python project. which I follow while doing the machine learning projects.

Setting Up a Conda Environment

Anaconda play vital roles in the machine learning projects. It is a package manager, an environment manager, and Python distribution that contains a collection of many open-source packages.

To set up a Conda environment for this project, we can follow these steps:

  1. Install Anaconda or Miniconda if you haven't already.
  2. Open a terminal.
  3. Navigate to the project directory.
  4. Run the following command to create a new Conda environment:
conda create --n <env name> python==3.10

Activating a Conda Environment

conda activate <env name>

Directory Structure

This project has the following structure:

  • config/: This directory contains configuration files for your project.

  • config.ini: (This is an INI configuration file where we can store the database credentials, port number, etc.)

  • config.yaml: (This is a YAML configuration file, which serves the same purpose as the INI file.)

  • Dockerfile: This file is used to build a Docker image for your project.

  • logs/: This directory is where log files are stored.

  • log_details.log: This is a log file that will contain the log details of the project.

  • main.py: This is the main script for your project. (This will be the main script of the project.)

  • notebooks/: This directory is where Jupyter notebooks are stored.

  • notebook.ipynb: This is a Jupyter notebook. (This will contain the Jupyter notebook where we can experiment with the data and train the model.)

  • params.yaml: This file contains parameters for your project. (This will contain the parameters of the functions and so on.)

  • project_name/: This directory contains the main code for your project.

  • api/: This directory contains API-related code. (We can store API-related code here, like Flask, Fastapi, etc.)

  • __init__.py: This is an initialization file for the api module.

  • entity/: This directory contains entity-related code.

  • __init__.py: This is an initialization file for the entity module. (We can write or define the fixed parameter type of the different functions, like Box, List, etc.)

  • __init__.py: This is an initialization file for the project_name module.

  • pipeline/: This directory contains pipeline-related code. (This will contain pipeline-related code like data cleaning, feature engineering, etc.)

  • __init__.py: This is an initialization file for the pipeline module. 'services/': This directory contains service-related code. (This will contain the different services for the project, such as inference and so on.)

  • __init__.py: This is an initialization file for the'services' module.

  • utils/: This directory contains utility code.

  • __init__.py: This is an initialization file for the utils module.

  • README.md: This file provides an overview of your project and instructions on how to use it.

  • reports/: This directory is where you can place your report files.

  • reports.pdf: This is a PDF report.

  • requirements.txt: This file lists the Python dependencies for your project.

  • setup.py: This file is used to package your project.

  • template.py: This is a template script for your project.

  • test.py: This is a test script for your project.

generate project file structure

python template.py

Done! Now you can start your project.

About

While doing machine learning projects, managing code in a structured way is very crucial, so this repository contains a template for structuring a Python project. which I follow while doing the machine learning projects.


Languages

Language:Python 100.0%