-
Notifications
You must be signed in to change notification settings - Fork 80
Conversation
🚀 Deployed on https://deploy-preview-774--etna-docs.netlify.app |
Codecov Report
@@ Coverage Diff @@
## master #774 +/- ##
==========================================
+ Coverage 83.80% 83.87% +0.07%
==========================================
Files 123 124 +1
Lines 6902 6941 +39
==========================================
+ Hits 5784 5822 +38
- Misses 1118 1119 +1
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
… into assemble_pipelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, however it does not work as stated in the issue description.
It should match not only model-horizon, but transforms-models in case if we want different transform for different models. The example of this behaviour could be seen in the issue description.
Important note: if we want to skip transform for the model we use None instead
assemble_pipelines([Catboost(), Prophet()], [TrendTransform(in_column="target"), [LagTransform(lags=[1,2,3], in_column="target"), **None**], [1, 2])
Pipeline(model=Catboost(), transforms=[TrendTransform(in_column="target"), LagTransform(lags=[1,2,3], in_column="target")], horizon=1)
Pipeline(model=Prophet(), transforms=[TrendTransform(in_column="target")], horizon=2)
Also there are not enough tests.
You should add test case if we have different models for different horizons, as well as different transforms for different models.
etna/pipeline/assemble_pipelines.py
Outdated
|
||
def assemble_pipelines( | ||
models: Union[BaseModel, Sequence[BaseModel]], | ||
transforms: Sequence[Transform], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be able to work with cases such as
assemble_pipelines(Catboost(), [TrendTransform(in_column="target"), [LagTransform(lags=[1,2,3], in_column="target"), LagTransform(lags=[2,3,4], in_column="target")]], [1, 2])
And as a result it should create the following two pipelines:
Pipeline(model=Catboost(), transforms=[TrendTransform(in_column="target"), LagTransform(lags=[1,2,3], in_column="target")], horizon=1)
Pipeline(model=Catboost(), transforms=[TrendTransform(in_column="target"), LagTransform(lags=[2,3,4], in_column="target")], horizon=2)
from etna.transforms import TrendTransform | ||
|
||
|
||
def test_not_equal_lengths(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea for test! 👍
5a46015
to
2193692
Compare
c3f97d8
to
2036630
Compare
etna/pipeline/assemble_pipelines.py
Outdated
horizons: | ||
Sequence of horizons | ||
|
||
Raises |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should swap raises and returns blocks and add empty line between them.
etna/pipeline/__init__.py
Outdated
@@ -1,3 +1,4 @@ | |||
from etna.pipeline.autoregressive_pipeline import AutoRegressivePipeline | |||
from etna.pipeline.base import FoldMask | |||
from etna.pipeline.pipeline import Pipeline | |||
from etna.pipeline.pipelines_fabric import assemble_pipelines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fabric -- is a material to make clothes. Try smth like "assmbling_pipelines" for file name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pipeline_assembling
etna/pipeline/assmbling_pipelines.py
Outdated
transforms: Sequence[Union[Transform, Sequence[Optional[Transform]]]], | ||
horizons: Union[int, Sequence[int]], | ||
) -> List[Pipeline]: | ||
"""Create pipelines from input horizons and models or sequence of models. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be just:
Create pipelines with broadcasting from models, transforms and horizons.
etna/pipeline/assmbling_pipelines.py
Outdated
Parameters | ||
---------- | ||
models: | ||
Instance or Sequence of the etna Model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instance of Sequence of models
etna/pipeline/assmbling_pipelines.py
Outdated
models: | ||
Instance or Sequence of the etna Model | ||
transforms: | ||
Sequence of the transforms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should explain here how broadcasting is made. It is not obvious.
etna/pipeline/assmbling_pipelines.py
Outdated
horizons: Union[int, Sequence[int]], | ||
) -> List[Pipeline]: | ||
"""Create pipelines from input horizons and models or sequence of models. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we should add description about broadcasting here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Ready to merge. Fixed import errors.
ValueError: | ||
If the length of models sequence not equals to length of horizons sequence. | ||
|
||
Examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This is a good practice
0906411
to
9810481
Compare
Before submitting (must do checklist)
Proposed Changes
Closing issues
closes #717