Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Get started DVC project

NotificationsYou must be signed in to change notification settings

DeepLearning-python/example-get-started

 
 

Repository files navigation

This is an auto-generated repository for use in DVCGet Started. It is a step-by-step quickintroduction into basic DVC concepts.

The project is a natural language processing (NLP) binary classifier problem ofpredicting tags for a given StackOverflow question. For example, we want oneclassifier which can predict a post that is about the Python language by taggingitpython.

🐛 Please report any issues found in this project here -example-repos-dev.

Installation

Python 3.6+ is required to run code from this repo.

$git clone https://github.com/iterative/example-get-started$cd example-get-started

Now let's install the requirements. But before we do that, westronglyrecommend creating a virtual environment with a tool such asvirtualenv:

$virtualenv -p python3 .env$source .env/bin/activate$pip install -r src/requirements.txt

This instruction assumes that DVC is already installed, as it is frequentlyused as a global tool like Git. If DVC is not installed, see theDVC installation guide on how to install DVC.

This DVC project comes with a preconfigured DVCremote storage that holds rawdata (input), intermediate, and final results that are produced. This is aread-only HTTP remote.

$dvc remote liststorage https://remote.dvc.org/get-started

You can rundvc pull to download the data:

$dvc pull

Running in your environment

Rundvc repro to reproduce thepipeline:

$dvc reproData and pipelines are up to date.

If you'd like to test commands likedvc push,that require write access to the remote storage, the easiest way would be to setup a "local remote" on your file system:

This kind of remote is located in the local file system, but is external tothe DVC project.

$mkdir -p /tmp/dvc-storage$dvc remote addlocal /tmp/dvc-storage

You should now be able to run:

$dvc push -rlocal

Existing stages

This project with the help of the Git tags reflects the sequence of actions thatare run in the DVCget started guide. Feelfree to checkout one of them and play with the DVC commands having theplayground ready.

  • 0-git-init: Empty Git repository initialized.
  • 1-dvc-init: DVC has been initialized..dvc/ with the cache directorycreated.
  • 2-track-data: Raw data filedata.xml downloaded and tracked with DVC usingdvc add. First.dvc file created.
  • 3-config-remote: Remote HTTP storage initialized. It's a shared read onlystorage that contains all data artifacts produced during next steps.
  • 4-import-data: Usedvc import to get the samedata.xml from the DVC dataregistry.
  • 5-source-code: Source code downloaded and put into Git.
  • 6-prepare-stage: Createdvc.yaml and the first pipeline stage withdvc run. It transforms XML data into TSV.
  • 7-ml-pipeline: Feature extraction and train stages created. It takes data inTSV format and produces two.pkl files that contain serialized featurematrices. Train runs random forest classifier and creates themodel.pkl file.
  • 8-evaluation: Evaluation stage. Runs the model on a test dataset to produceits performance AUC value. The result is dumped into a DVC metric file so thatwe can compare it with other experiments later.
  • 9-bigrams-model: Bigrams experiment, code has been modified to extract morefeatures. We rundvc repro for the first timeto illustrate how DVC can reuse cached files and detect changes along thecomputational graph, regenerating the model with the updated data.
  • 10-bigrams-experiment: Reproduce the evaluation stage with the bigrams basedmodel.
  • 11-random-forest-experiments: Reproduce experiments to tune the randomforest classifier parameters and select the best experiment.

There are three additional tags:

  • baseline-experiment: First end-to-end result that we have performance metricfor.
  • bigrams-experiment: Second experiment (model trained using bigramsfeatures).
  • random-forest-experiments: Best of additional experiments tuning randomforest parameters.

These tags can be used to illustrate-a or-T options across differentDVC commands.

Project structure

The data files, DVC files, and results change as stages are created one by one.After cloning and usingdvc pull to download datatracked by DVC, the workspace should look like this:

$tree.├── README.md├── data                  # <-- Directory with raw and intermediate data│   ├── data.xml          # <-- Initial XML StackOverflow dataset (raw data)│   ├── data.xml.dvc      # <-- .dvc file - a placeholder/pointer to raw data│   ├── features          # <-- Extracted feature matrices│   │   ├── test.pkl│   │   └── train.pkl│   └── prepared          # <-- Processed dataset (split and TSV formatted)│       ├── test.tsv│       └── train.tsv├── dvc.lock├── dvc.yaml              # <-- DVC pipeline file├── model.pkl             # <-- Trained model file├── params.yaml           # <-- Parameters file├── prc.json              # <-- Precision-recall curve data points├── roc.json              # <-- ROC curve data points├── scores.json           # <-- Binary classifier final metrics (e.g. AUC)└── src                   # <-- Source code to run the pipeline stages    ├── evaluate.py    ├── featurization.py    ├── prepare.py    ├── requirements.txt  # <-- Python dependencies needed in the project    └── train.py

About

Get started DVC project

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python100.0%

[8]ページ先頭

©2009-2025 Movatter.jp