Skip to content

Conversation

@youdongguo
Copy link
Member

No description provided.

@youdongguo youdongguo requested a review from timholy August 5, 2025 03:19
Copy link
Member

@timholy timholy left a comment

Choose a reason for hiding this comment

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

Very nice. You've done a good job of ensuring this change does not break the public API of the package, while being free to change unexported internals.

src/NMFMerge.jl Outdated
end

mergepenalty(λ_min, t1sq, t2sq) = λ_min
shotpenalty(λ_min, t1sq, t2sq) = λ_min / sqrt(min(t1sq, t2sq))
Copy link
Member

Choose a reason for hiding this comment

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

Should we consider exporting mergepenalty and shotpenalty? If so, they would need docstrings and each to have tests. Alternatively we could keep them private. If so, then since shotpenalty is untested perhaps it should not be in this package?

Copy link
Member Author

Choose a reason for hiding this comment

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

Deleted shotpenalty, I think keeping it private at this moment is better as I am not sure how to describe the queuepenalty in a good way. We have a queuepenalty work in a fixed way as: f(E, t1sq, t2sq), users cannot define a customized penalty function.

Copy link
Member

Choose a reason for hiding this comment

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

Once this merges, they will be able to define their own queuepenalty, but I like the idea of not exporting anything.

@timholy
Copy link
Member

timholy commented Aug 5, 2025

Either in this PR or after you merge it, you should release this as v1.1.0 of the package. (It's a new feature, so it should bump the minor version number.)

One more thought, it might be worth mentioning the possibility of passing in a queuepenalty in the docstring. You'll want to describe the API that it should satisfy.

Copy link
Member

@timholy timholy left a comment

Choose a reason for hiding this comment

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

Just a reminder that only a few things (mostly documentation) remain before merging:

  • indicate that queuepenalty is an optional argument to nmfmerge, e.g., with nmfmerge([queuepenalty,] X, ...) or by using two lines, one supplying queuepenalty and one not (see #33 (comment))
  • describe the meaning of the t1sq and t2sq arguments for queuepenalty
  • Docstring for colmerge2to1pq (which is also exported) should be updated to include queuepenalty. You can refer readers to the docstring for nmfmerge for an explanation about the queuepenalty API, rather than repeating the same material all over again.
  • It would be ideal to add a test where the user supplies a custom queuepenalty and verify that it changes the merge order
  • bump the version number to 1.1.0 in the Project.toml so this is ready to register as a new version

@timholy
Copy link
Member

timholy commented Sep 3, 2025

Bump

@youdongguo youdongguo requested a review from timholy September 3, 2025 20:30
@timholy
Copy link
Member

timholy commented Sep 4, 2025

Still needs a test. You could probably use something like

nmfmerge(X, ...) do E, t1sq, t2sq
    return -E
end

and then test that it picks out the worst pair to merge.

Copy link
Member

@timholy timholy left a comment

Choose a reason for hiding this comment

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

Still needs a test of nmfmerge(my_custom_queuepenalty, args...) (one where you show that different penalties result in different merge choices) before we can merge this.

Copy link
Member

@timholy timholy left a comment

Choose a reason for hiding this comment

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

Let's merge and release a new version!

@youdongguo youdongguo merged commit 2e14f60 into main Sep 18, 2025
2 checks passed
@youdongguo youdongguo deleted the yg/add_queuepenalty branch September 18, 2025 18:07
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.

3 participants