cookiecutter-data-science README

The project's README from github.com/drivendataorg/cookiecutter-data-science. As one markdown file: README.md.

Cookiecutter Data Science

A logical, reasonably standardized but flexible project structure for doing and sharing data science work.

PyPI - Version PyPI - Python Version tests

Cookiecutter Data Science (CCDS) is a tool for setting up a data science project template that incorporates best practices. To learn more about CCDS's philosophy, visit the project homepage.

ℹ️ Cookiecutter Data Science v2 has changed from v1. It now requires installing the new cookiecutter-data-science Python package, which extends the functionality of the cookiecutter templating utility. Use the provided ccds command-line program instead of cookiecutter.

Installation

Cookiecutter Data Science v2 requires Python 3.9+. Since this is a cross-project utility application, we recommend installing it with pipx. Installation command options:

# With pipx from PyPI (recommended)
pipx install cookiecutter-data-science

# With pip from PyPI
pip install cookiecutter-data-science

# With conda from conda-forge (coming soon)
# conda install cookiecutter-data-science -c conda-forge

Starting a new project

To start a new project, run:

ccds

The resulting directory structure

The directory structure of your new project will look something like this (depending on the settings that you choose):

├── LICENSE            <- Open-source license if one is chosen
├── Makefile           <- Makefile with convenience commands like `make data` or `make train`
├── README.md          <- The top-level README for developers using this project.
├── data
│   ├── external       <- Data from third party sources.
│   ├── interim        <- Intermediate data that has been transformed.
│   ├── processed      <- The final, canonical data sets for modeling.
│   └── raw            <- The original, immutable data dump.
│
├── docs               <- A default mkdocs project; see www.mkdocs.org for details
│
├── models             <- Trained and serialized models, model predictions, or model summaries
│
├── notebooks          <- Jupyter notebooks. Naming convention is a number (for ordering),
│                         the creator's initials, and a short `-` delimited description, e.g.
│                         `1.0-jqp-initial-data-exploration`.
│
├── pyproject.toml     <- Project configuration file with package metadata for 
│                         {{ cookiecutter.module_name }} and configuration for tools like black
│
├── references         <- Data dictionaries, manuals, and all other explanatory materials.
│
├── reports            <- Generated analysis as HTML, PDF, LaTeX, etc.
│   └── figures        <- Generated graphics and figures to be used in reporting
│
├── requirements.txt   <- The requirements file for reproducing the analysis environment, e.g.
│                         generated with `pip freeze > requirements.txt`
│
├── setup.cfg          <- Configuration file for flake8
│
└── {{ cookiecutter.module_name }}   <- Source code for use in this project.
    │
    ├── __init__.py             <- Makes {{ cookiecutter.module_name }} a Python module
    │
    ├── config.py               <- Store useful variables and configuration
    │
    ├── dataset.py              <- Scripts to download or generate data
    │
    ├── features.py             <- Code to create features for modeling
    │
    ├── modeling                
    │   ├── __init__.py 
    │   ├── predict.py          <- Code to run model inference with trained models          
    │   └── train.py            <- Code to train models
    │
    └── plots.py                <- Code to create visualizations   

Using unreleased changes

By default, ccds will use the project template version that corresponds to the installed ccds package version (e.g., if you have installed ccds v2.0.1, you'll use the v2.0.1 version of the project template by default). To use a specific version of the project template, use the -c/--checkout flag to provide the branch (or tag or commit hash) of the version you'd like to use. For example to use the project template from the master branch:

ccds -c master

Using v1

If you want to use the old v1 project template, you need to have either the cookiecutter-data-science package or cookiecutter package installed. Then, use either command-line program with the -c v1 option:

ccds https://github.com/drivendataorg/cookiecutter-data-science -c v1
# or equivalently
cookiecutter https://github.com/drivendataorg/cookiecutter-data-science -c v1

Contributing

We welcome contributions! See the docs for guidelines.

Installing development requirements

pip install -r dev-requirements.txt

Running the tests

pytest tests

cookiecutter-data-science (drivendataorg/cookiecutter-data-science)

Searching Database…

这是什么东西?这是 Cookiecutter Data Science(CCMS,即 CCDS),一个用来搭建数据科学项目骨架的工具。它基于一个内置了最佳实践的模板,让每个项目都拥有合理、规范而又灵活的结构。
它是我代码里要导入的库,还是一个我直接运行的工具?是一个命令行工具,不是库。你安装 cookiecutter-data-science 这个 Python 包,然后用它的 ccds 程序来生成项目骨架——不需要在代码里导入任何东西。
我怎么获取它并开始一个新项目?用 pipx 安装它(这是跨项目命令行工具的推荐安装方式),然后运行 ccds 来创建项目;它会询问你的配置选项,并生成相应的文件夹结构。
运行它之前我需要先装什么吗?v2 版本的硬性要求是 Python 3.9 或更新版本。pipx 是推荐的安装工具,它同样来自 Python 生态。
v2 相比 v1 改动很大——我还能拿到旧模板,或者固定用某个模板版本吗?默认情况下,ccds 会使用与你安装的包版本匹配的模板。可以通过 -c/--checkout 参数指定一个分支、标签或提交来选择其他版本,或者用 -c v1 获取旧的 v1 目录结构。
用 ccds 生成的项目里到底有什么?一个为数据科学工作准备好的现成目录结构。具体有哪些文件夹取决于你在生成过程中选择的配置,所以每个项目都会略有针对性。
它和 cookiecutter 本身是什么关系?Cookiecutter 是一个独立的项目模板工具。CCDS v2 以自己的包 cookiecutter-data-science 发布,它在 cookiecutter 的功能基础上做了扩展——你运行的是它的 ccds 命令。
为什么要注意项目结构的规范化?一个合理、较为规范而又灵活的目录结构能让数据科学工作更容易开展和分享,也能让各个项目保持一致。完整的理念说明可以看 README 里指向的项目主页。
Size
1.3 MB
Stars
10.1K
Age
10y
Commits · 90 Days