Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix forwarding arguments for flagser #21

Merged
merged 6 commits into from
Mar 20, 2020
Merged

Conversation

reds-heig
Copy link
Collaborator

@reds-heig reds-heig commented Mar 19, 2020

Reference Issues/PRs

What does this implement/fix? Explain your changes.

Fixes multiples issues where forwarding arguments to flagser.

  • filtration was not correctly forwarded and it always fallback to zero filtration.
  • max-dim and min-dim were always equal to 0.
  • Tests added for the different filtrations
  • CMakeLists updated to disable AVX instructions and enable compile flags on MSVC

Any other comments?

julian added 2 commits March 19, 2020 21:04
Signed-off-by: julian <julian.burellaperez@heig-vd.ch>
std::to_string(<something>).c_str() creates a temporary reference
Which was lost in named_arguments, due to that max-dim and min-dim
where always equal to 0 ...

Signed-off-by: julian <julian.burellaperez@heig-vd.ch>
@ulupo
Copy link
Collaborator

ulupo commented Mar 20, 2020

@MonkeyBreaker thanks for the fixes! However, can we please also add those tests before merging? It is too important as we have seen, and would reduce review time somewhat.

@MonkeyBreaker
Copy link
Collaborator

Sure, I'm preparing and verifying them.
But I would like double cross-check when I push them to be sure I do not add more errors ...

@ulupo
Copy link
Collaborator

ulupo commented Mar 20, 2020

@MonkeyBreaker thanks. Sure, take your time!

Signed-off-by: julian <julian.burellaperez@heig-vd.ch>
Copy link
Collaborator

@ulupo ulupo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to check: were the expected results computed purely using the C++ flagser?

def test_filtrations(flag_file):
"""
Testing all filtrations available for dataset d5.flag
It was necessary to disable edge filtrations because of assumption that the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this in more detail (not in docstring, just here for now)? What does "disabling edge filtrations" look like in the C++ code?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well when testing with the data of the d5.flag, vertex_degree filtration produces a segmentation fault in C++, so I assumed it was related to the warning in the documentation about the filtration. And I copy/pasted on the docstring to explain the reason not all filtrations are tested.

But, the example I was working earlier this week, with data generated by squareform(pdist(np.random.random((5, 2)))). Filtration vertex_degree does work.

Am I wrong ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MonkeyBreaker now you're talking about vertex_degree filtrations, but in the docstrings you are referring to "edge filtrations". Could you explain the relation?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the documentation:

filtration : string, optional, default: 'max'
Algorithm determining the filtration. Warning: if an edge filtration is
specified, it is assumed that the resulting filtration is consistent,
meaning that the filtration value of every simplex of dimension at
least two should evaluate to a value that is at least the maximal value
of the filtration values of its containing edges. For performance
reasons, this is not checked automatically.

When I was performing tests, I encountered segmentation faults running flagser on d5.flag with vertex_degree filtration, on the bindings and with the C++ implementation. Trying to understand why this could happen, I assumed it was related to the remark from the documentation.

@MonkeyBreaker
Copy link
Collaborator

Result were controlled with the c++ implementation, same result obtained.

julian added 3 commits March 20, 2020 15:00
Signed-off-by: julian <julian.burellaperez@heig-vd.ch>
Signed-off-by: julian <julian.burellaperez@heig-vd.ch>
Fix windows compilation, disable AVX instructions

Signed-off-by: julian <julian.burellaperez@heig-vd.ch>
Copy link
Collaborator

@ulupo ulupo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MonkeyBreaker are you happy to merge this once pipelines succeed?

@MonkeyBreaker
Copy link
Collaborator

Sure, I'm creating the issues, and if I have some time, try to explore why the segmentation fault is raised.

@ulupo ulupo merged commit fa8442f into giotto-ai:master Mar 20, 2020
@ulupo ulupo mentioned this pull request Mar 20, 2020
ulupo added a commit that referenced this pull request Mar 21, 2020
* Fix forwarding arguments for flagser (#21)

* Add test for filtrations

* Align CMakeLists as used in giotto-tda

Fix windows compilation, disable AVX instructions

* Bump to v0.2.1 (#24)
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.

None yet

3 participants