pyronear / pyro-risks

Data science for wildfire risk forecasting and monitoring
https://pyronear.github.io/pyro-risks
Apache License 2.0
25 stars 8 forks source link

Training pipeline life-cycle management (1/2) #52

Closed jsakv closed 3 years ago

jsakv commented 3 years ago

This PR introduces the first half of modifications required to resolve issue #51, namely:

Here is how the new package tree looks like:

├── pyro_risks
│   ├── __init__.py
│   ├── config
│   ├── datasets
│   ├── pipeline
│   │   ├── __init__.py
│   │   ├── evaluate.py
│   │   ├── load.py
│   │   ├── predict.py
│   │   ├── score_v0.py
│   │   └── train.py
│   ├──  main.py        # --> CLI
│   └──  version.py

Pipeline sub-package

The new modules allow to load the training dataset, train the pipeline and finally to evaluate and persist the pipeline performance metrics :

test

The predict module will be refactored when resolving issue #37

Command Line Interface

The CLI is built with click here are some example of the behavior:

# Download training datasets
pyrorisks download

# Train Random Forest Pipeline
pyrorisks train --model RF

# Evaluate pipeline performance
pyrorisks evaluate --pipeline ~/.cache/model_registry/RF.joblib --prefix RF --destination .cache/metadata_registry 

Let me know what you think!

codecov[bot] commented 3 years ago

Codecov Report

Merging #52 (85a4715) into master (6908e55) will increase coverage by 0.56%. The diff coverage is 99.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #52      +/-   ##
==========================================
+ Coverage   95.36%   95.92%   +0.56%     
==========================================
  Files          23       27       +4     
  Lines         949     1055     +106     
==========================================
+ Hits          905     1012     +107     
+ Misses         44       43       -1     
Flag Coverage Δ
unittests 95.92% <99.28%> (+0.56%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyro_risks/pipeline/predict.py 84.61% <ø> (ø)
pyro_risks/pipeline/score_v0.py 90.14% <ø> (ø)
pyro_risks/main.py 97.05% <97.05%> (ø)
pyro_risks/__init__.py 100.00% <100.00%> (ø)
pyro_risks/config/datasets.py 100.00% <100.00%> (ø)
pyro_risks/pipeline/__init__.py 100.00% <100.00%> (ø)
pyro_risks/pipeline/evaluate.py 100.00% <100.00%> (ø)
pyro_risks/pipeline/load.py 100.00% <100.00%> (ø)
pyro_risks/pipeline/train.py 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6908e55...85a4715. Read the comment docs.