-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
MCP max_cost and max_cummulative_cost parameters do nothing #7604
Comments
Looking at the code, it seems to me that the parameters The parameters have been introduced with the pull request #854. The pull request was quite big so it might just have been forgotten. @stefanv Do you still remember anything from this pull request and whether there was any intention behind it? I know it was already 10 years ago 😲 |
Hrm, wow, no but maybe @almarklein does 😅 |
Looking at the history of From what I remember, I had an implementation of the MCP algorithm that I had used locally in my research. I refactored it a bit as I added the code to skimage. I think that these args represent a feature that I had in my own version, but these were not really necessary because the new class had hooks to implement things like that. As to their intended meaning, I think Funny how this was found only now. I'm sorry if I confused users by having introduced arguments that do nothing. |
@helvince everyone else, thanks for catching and diagnosing this. It sounds unlikely that anyone is planning to fill the unused parameters with life anytime soon. So I suggest to just deprecate them.
@almarklein, that sounds intriguing. In case anyone is interested in things like that, how would they go about using these class hooks? A few pointers could be helpful in documenting this or even implementing this if someone wants to add that feature. :) |
There's |
It seems to me that this condition can be easily checked right here to skip that voxel: scikit-image/skimage/graph/_mcp.pyx Line 590 in 3a82599
@almarklein Do you agree? I can open a merge request to implement |
Yeah, probably just replace |
I opened a merge request for the discussed changes scikit-image/skimage/graph/_mcp.pyx Line 612 in a854ec5
What still irritates me is that scikit-image/skimage/graph/_mcp.pyx Line 612 in a854ec5
@almarklein Is there a special reasoning behind not copying the |
That does seem weird. It makes sense that the method modifies the attribute in place but might be a different story for arrays returned by the method. Doesn't seem like a case that should be especially memory sensitive. |
I don't remember, maybe performance. If returning a copy (or a readonly view?) is more skimage-like, go ahead! 👍 |
@almarklein Thanks for the info. Another question, the parameter scikit-image/skimage/graph/_mcp.pyx Line 396 in aa7042c
I wanted to add some but it seems like it was only useful while developing: scikit-image/skimage/graph/_mcp.pyx Line 492 in aa7042c
@almarklein Do you agree that we can deprecate that one, too? Or might it be useful for some users? |
I guess it could still be useful, e.g. if you know that the explored area should never make up more than 20% of the total image, it allows you to stop failure-cases 5x faster. Definitely a bit of a niche, but you never know if someone is using it, and the cost for maintaining is is near-zero 🤷 |
Well, except for writing a docstring 😉 |
Description:
I was hoping to speed up MCP by confining the paths using max_cost and max_cumulative_cost. Neither parameter displays the expected effects (output is not effected by either).
I expect the max_cost to either a) clip the cost to some maximum value or b) do not allow paths through nodes with a cost value above max_cost. The latter ofcourse being the most logical, as I could clip the input myself.
I expect the max_cumulative_cost to restrict paths up to some total cost. I can simply apply the threshold afterwards, but I expect the algorithm to converge quicker if this is taken into account.
Way to reproduce:
The text was updated successfully, but these errors were encountered: