Skip to content

[DO NOT FORK/CLONE | JUST CLICK ON "USE THIS TEMPLATE" BUTTON] Supercharge your Python machine learning projects with the comprehensive and organized structure provided by the Python Machine Learning Template. πŸš€πŸ

License

Notifications You must be signed in to change notification settings

anujonthemove/Python-Machine-Learning-Template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

91 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐍 Python Machine Learning Template

MIT License Code style: black pre-commit

Linux macOS Windows

The Python Machine Learning Template is designed to provide a comprehensive structure for end-to-end Machine Learning projects in Python. Whether you're working on Computer Vision, Natural Language Processing, Reinforcement Learning, or traditional Machine Learning/Data Science, this template offers a simple and intuitive way to organize and manage your project.

click this button to use the template

To get started, simply click on the above button πŸ‘† or "Use this template" button at the top and create your project based on this template.

check detailed documentation here

The following sections provide an overview of the directory structure and instructions for setting up your project workspace.

πŸ—‚οΈ Directory Structure


.
β”œβ”€β”€ config/                  <- πŸ“‚ Configuration files [.ini, .json, .yaml]
β”œβ”€β”€ data/                    <- πŸ“‚ Images, numpy data objects, text files
β”œβ”€β”€ docs/                    <- πŸ“‚ Store .md files. Used by Mkdocs for Project Documentation
β”œβ”€β”€ helpers/                 <- πŸ“‚ Utility/helper files/modules for the project
β”œβ”€β”€ html/                    <- πŸ“‚ Store .html files and accompanying assets. Used by pdoc3 for API Documentation
β”œβ”€β”€ logs/                    <- πŸ“‚ Log files generated by the project during execution
β”œβ”€β”€ models/                  <- πŸ“‚ Model files [.h5, .pkl, .pt] - pre-trained weight files, snapshots, checkpoints
β”œβ”€β”€ notebooks/               <- πŸ“‚ Jupyter Notebooks
β”œβ”€β”€ references/              <- πŸ“‚ Data dictionaries, manuals, and all other explanatory materials
β”œβ”€β”€ scripts/                 <- πŸ“‚ Utility scripts for various project-related tasks
β”œβ”€β”€ src/                     <- πŸ“‚ Source code (.py files)
β”œβ”€β”€ tests/                   <- πŸ“‚ Unit tests for the project
β”œβ”€β”€ workspaces/              <- πŸ“‚ Multi-user workspace that can be used in the case of a single machine
β”œβ”€β”€ .env-template            <- πŸ”§ Template for the .env file
β”œβ”€β”€ .gitattributes           <- πŸ”§ Standard .gitattributes file
β”œβ”€β”€ .gitignore               <- πŸ“› Standard .gitignore file
β”œβ”€β”€ .pre-commit-config.yaml  <- πŸ”§ Config file for Git Hooks
β”œβ”€β”€ LICENSE                  <- πŸͺ§ License file [choose your appropriate license from GitHub]
β”œβ”€β”€ mkdocs.yml               <- πŸ—žοΈ Base config file required for Mkdocs
β”œβ”€β”€ Pipfile		              <- πŸ—ƒοΈ Most commonly used python packages
β”œβ”€β”€ project_setup.bat        <- πŸ“œ Project script for Windows OS
β”œβ”€β”€ project_setup.sh         <- πŸ“œ Project script for Linux/MacOS
β”œβ”€β”€ README.md                <- πŸ“ Project readme
β”œβ”€β”€ setup.py                 <- πŸ“¦οΈ For installing & packaging the project
└── tox.ini                  <- πŸ”§ General-purpose package configuration manager

πŸš€ Features

  • πŸ€“ Simple, intuitive, yet comprehensive directory structure for organizing your machine learning project.

  • 😎 Setup script provided for Windows, Mac, and Linux. Check Setup section for more details.

  • πŸ€— Only requires native Python and Virtual Environment package installed.

  • 🀩 Uses Pipenv. Here are some of the advantages of using it:

    • πŸ’ͺ Consolidated Tooling: By combining the functionalities of pip, virtualenv, and package management, Pipenv eliminates the need to use these tools separately.

    • 🀌 Simplified Dependency Management: Pipenv removes the need for the requirements.txt file and replaces it with the Pipfile, which effectively tracks dependencies. Additionally, Pipenv utilizes the Pipfile.lock to ensure consistent and reliable application builds.

    • 🀟 Cross-Platform Compatibility: Pipenv supports a wide range of operating systems, including Linux, macOS, and Windows.

πŸ› οΈ Setup

Project setup scripts have been provided separately for Linux/MacOS and Windows OS.

Checkout the demo quick setup.

πŸŽ₯ Demo

asciicast

Command details

## For Linux/MacOS
source project_setup.sh [OPTIONS] 

or 

## For Windows OS
project_setup.bat [OPTIONS]

Replace [OPTIONS] with any combination of the following options:

  • --install: Required argument. If nothing is passed, a help message is displayed.

  • --install-dev: Optional argument. Pass this flag along with --install flag to install development packages.

  • --use-proxy: Optional argument. This flag enables installation of python packages behind proxy. Check Using .env section for proxy configuration.

  • --unset-proxy: Optional argument. This flag disables proxy.

  • --clear-readme: Optional argument. Clear README.md file after setting up the project.

    • πŸ“£ Caution: Use this only when you are setting up the project for the first time.
  • --remove-cache: Optional argument. Removes pip and pipenv cache files.

    • πŸ’‘ Use this to clear cache files generated during package installation
  • --help: Display the help message.

🐧 Instructions for Linux/MacOS

For setting up the project, project_setup.sh script has been provided along with some options.

πŸ§‘β€πŸ’» Steps:

  1. Open terminal and navigate to your project directory.

    Case (a): Setting up in Development environment

    If you are setting up the project inside development environment, use:

       source project_setup.sh --install --install-dev
    

    Incase you are working behind a proxy, use the following command instead:

       source project_setup.sh --install --install-dev --use-proxy
    

    Case (b): If you are setting up the project in production environment,

    If you are setting up the project inside production environment, you may only require base packages to be installaed, use:

       source project_setup.sh --install
    

    If you are working behind a proxy, use the following command:

       source project_setup.sh --install --use-proxy
    
  2. If you are setting up the project first time using this template, then you should replace contents of the README.md with the name of your project:

    source project_setup.sh --clear-readme
    

    Use this command only once in the development environment. DO NOT run this once you write your own readme. Also, do not run this in production environment.

πŸ“ Important Note

  • For any other package installation apart from the listed packages in Pipfile use pipenv as follows:

    pipenv install package_name
    

    By default, pipenv loads all the .env variables, therefore you need to unset the proxy first if you are not behind proxy.

    Use the following command:

    source project_setup.sh --unset-proxy
    

    You should then be able to install packages using pipenv as stated above.

  • During package installation, the packages are downloaded and cached. This consumes a lot of disk, hence you should clear pip and pipenv cache from time to time. Use the following command:

    source project_setup.sh --remove-cache
    
  • βœ… To ensure a conflict-free environment setup, it is strongly recommended to always run the project_setup.sh script to create a virtual environment for your project.

  • ❗You should run the script ONLY using the source command to ensure that the virtual environment .venv is automatically activated at the end of setup in the current shell session.

πŸͺŸ Instructions for Windows OS

For setting up the project, project_setup.bat script has been provided along with some options.

πŸ§‘β€πŸ’» Steps:

  1. Open Command Prompt (CMD) and navigate to your project directory.

    Case (a): Setting up in Development environment

    If you are setting up the project inside development environment, use:

    project_setup.bat --install --install-dev
    

    Incase you are working behind a proxy, use the following command instead:

    project_setup.bat --install --install-dev --use-proxy
    

    Case (b): If you are setting up the project in production environment,

    If you are setting up the project inside production environment, you may only require base packages to be installaed, use:

    project_setup.bat --install
    

    If you are working behind a proxy, use the following command:

    project_setup.bat --install --use-proxy
    
  2. If you are setting up the project first time using this template, then you should replace contents of the README.md with the name of your project:

    project_setup.bat --clear-readme
    

    Use this command only once in the development environment. DO NOT run this once you write your own readme. Also, do not run this in production environment.

πŸ“ Important Note

  • For any other package installation apart from the listed packages in Pipfile use pipenv as follows:

    pipenv install package_name
    

    By default, pipenv loads all the .env variables, therefore you need to unset the proxy first if you are not behind proxy.

    Use the following command:

    project_setup.bat --unset-proxy
    

    You should then be able to install packages using pipenv as stated above.

  • During package installation, the packages are downloaded and cached. This consumes a lot of disk, hence you should clear pip and pipenv cache from time to time. Use the following command:

    project_setup.bat --remove-cache
    
  • βœ… To ensure a conflict-free environment setup, it is strongly recommended to always run the project_setup.bat script to create a virtual environment for your project.

  • ❗For security reasons, organizations may prevent running .bat scripts on PowerShell. You should run the script ONLY on Command Prompt (CMD) to ensure that everything runs without any errors.

πŸ“¦ Packages

All the packages to be installed are included in the Pipfile. For installing additional packages ONLY pipenv should be used.

Base Packages

* numpy           <- for numerical computing and scientific computing
* scipy           <- mathematical algorithms and convenience functions built on the NumPy
* pandas          <- for data manipulation and analysis
* matplotlib      <- plotting library
* seaborn         <- data visualization library for drawing informative statistical graphics.
* scikit-learn    <- machine learning library 
* jupyter         <- web-based interactive computing platform
* jupyter-server  <- backend for Jupyter notebooks. Required when running notebooks in VS Code
* ipykernel       <- interactive Python shell. Required when running notebooks in VS Code
* ipython         <- provides a powerful interactive shell and a kernel for Jupyter

Development Packages

* isort                        <- sorts imports in a python file
* python-decouple              <- Reads configuration/settings from .env, system environment variables 
* flake8                       <- Code linter (format checker)
* flake8-tabs                  <- Tab (and Spaces) Style Checker for flake8
* black                        <- Code formatter
* mypy                         <- Static type checker
* pre-commit                   <- A framework for managing and maintaining multi-language pre-commit hooks.
* pdoc3                        <- Generate API documentation for Python projects
* mkdocs                       <- Generate Project documentation for Python projects

🌟 Star Us

If you find our project useful, please consider giving it a star on GitHub. 🀩

It motivates us to continue improving and adding new features. πŸ’ͺ

Thank you for your support ❀️

πŸ‘₯ Authors

About

[DO NOT FORK/CLONE | JUST CLICK ON "USE THIS TEMPLATE" BUTTON] Supercharge your Python machine learning projects with the comprehensive and organized structure provided by the Python Machine Learning Template. πŸš€πŸ

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published