Skip to content

datatypes.convert to infer indirect (chained) conversions when direct conversions are not implemented#1460

Closed
chrisholder wants to merge 1 commit intomainfrom
conversion-improved-paths
Closed

datatypes.convert to infer indirect (chained) conversions when direct conversions are not implemented#1460
chrisholder wants to merge 1 commit intomainfrom
conversion-improved-paths

Conversation

@chrisholder
Copy link
Copy Markdown
Collaborator

@chrisholder chrisholder commented Sep 26, 2021

Reference Issues/PRs

Requires PR #1423

What does this implement/fix? Explain your changes.

The current convert module only allows direct conversions. For example currently if I have a nested_univ and want to make it into a numpy_flat I am unable to do this. This is because there is no direct conversion between the two implemented. However, there is an indirect conversion that can be done which is nested_univ -> numpy3D -> numpy_flat. This pr has updated the convert module to allow these indirect paths to be found and used. Therefore this pr greatly improves the coverage of conversions.

It does this by using an adjacency matrix which defines which conversion are avaliable and then using dijsktras optimal path to find an indirect path.

In addition using this methods the weights (or length of the paths) can be adjusted to only allow lossy or lossless conversions. This is taken into account and when the user wants a lossless conversion to be done paths that would lead to loss are not considered. However, when the user is fine with loss then all paths are considered.

Does your contribution introduce a new dependency? If yes, which one?

What should a reviewer concentrate their feedback on?

Requires PR #1423 as this contains the enums needed to find paths.

Any other comments?

PR checklist

For all contributions
  • I've added myself to the list of contributors.
  • Optionally, I've updated sktime's CODEOWNERS to receive notifications about future changes to these files.
  • I've added unit tests and made sure they pass locally.
For new estimators
  • I've added the estimator to the online documentation.
  • I've updated the existing example notebooks or provided a new one to showcase how my estimator works.

@fkiraly fkiraly changed the title Convert module use indirect paths datatypes.convert to infer indirect (chained) conversions when direct conversions are not implemented Sep 26, 2021
@fkiraly
Copy link
Copy Markdown
Collaborator

fkiraly commented Sep 26, 2021

Really nice, thanks a lot! Much needed.

Before discuss this though, let's focus on #1423 and get this merged - that would require hammering out the last areas of design questions and making potential changes there.

So I'd recommend to focus on #1423 design write-up and a round (perhaps targeted meetings) with @ABostrom (because of the link to the proposed typing in #974, #973).

@fkiraly
Copy link
Copy Markdown
Collaborator

fkiraly commented Apr 25, 2022

@chrisholder, could we keep these open? I might be using this someday!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants