Skip to content

[BUG] Method to_dict doesn't capture parameters of classes from external libraries #1256

Open
1 task done
Mr-Geekman opened this issue May 3, 2023 · 0 comments
Open
1 task done
Labels
bug Something isn't working priority/medium Medium priority task

Comments

@Mr-Geekman
Copy link
Contributor

Mr-Geekman commented May 3, 2023

🐛 Bug Report

We want to distinguish between transforms

transform_1 = ChangePointsTrendTransform(
    in_column="target",
    change_points_model=RupturesChangePointsModel(
        change_points_model=Binseg(model="ar"),
        n_bkps=5,
    ),
)
transform_2 = ChangePointsTrendTransform(
    in_column="target",
    change_points_model=RupturesChangePointsModel(
        change_points_model=Binseg(model="l1"),
        n_bkps=5,
    )
)

But currently they have the same to_dict, because Binseg isn't etna class.

We can have a similar problem with other external classes too, we should try to create a general solution for all such cases.

Expected behavior

We should learn how to handle external classes correctly.

How To Reproduce

from ruptures import Binseg

from etna.transforms.decomposition import RupturesChangePointsModel
from etna.transforms import ChangePointsTrendTransform


def main():
    transform_1 = ChangePointsTrendTransform(
        in_column="target",
        change_points_model=RupturesChangePointsModel(
            change_points_model=Binseg(model="ar"),
            n_bkps=5,
        ),
    )
    transform_2 = ChangePointsTrendTransform(
        in_column="target",
        change_points_model=RupturesChangePointsModel(
            change_points_model=Binseg(model="l1"),
            n_bkps=5,
        )
    )

    assert transform_1.to_dict() != transform_2.to_dict()


if __name__ == "__main__":
    main()

Environment

No response

Additional context

No response

Checklist

  • Bug appears at the latest library version
@Mr-Geekman Mr-Geekman added the bug Something isn't working label May 3, 2023
@Mr-Geekman Mr-Geekman changed the title [BUG] Method to_dict doesn't capture Binseg parameters [BUG] Method to_dict doesn't capture parameters of classes from external libraries Jun 6, 2023
@Mr-Geekman Mr-Geekman added the priority/medium Medium priority task label Jun 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working priority/medium Medium priority task
Projects
Status: Todo
Development

No branches or pull requests

1 participant