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.
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:
- Install Anaconda or Miniconda if you haven't already.
- Open a terminal.
- Navigate to the project directory.
- Run the following command to create a new Conda environment:
conda create --n <env name> python==3.10
conda activate <env name>
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 theapi
module. -
entity/
: This directory contains entity-related code. -
__init__.py
: This is an initialization file for theentity
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 theproject_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 thepipeline
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 theutils
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.
python template.py
Done! Now you can start your project.