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

Reward certain substructure matching #86

Closed
frank-stonybrook opened this issue May 21, 2024 · 5 comments
Closed

Reward certain substructure matching #86

frank-stonybrook opened this issue May 21, 2024 · 5 comments

Comments

@frank-stonybrook
Copy link

Dear Reinvent4 developer,

Thanks for developing such an amazing tool!

I did a quick look at the code as well as the manuscript and am wondering whether it is possible to reward the generation of certain substructures. It seems to me that both CustomAlerts and MatchingSubstructure will penalize the matching of substructures.

Thanks

@halx
Copy link
Contributor

halx commented May 22, 2024

Hi,

many thanks for your interest in REINVENT and welcome to the community!

Yes, those components would be suitable for that as both take SMARTS. Just be aware that they work differently. CustomAlerts is a filter and MatchingSubstructure a penalty which technically runs last and multiplies the total score with 0.5 if the pattern does not match.

Many thanks,
Hannes.

@frank-stonybrook
Copy link
Author

Thanks Hannes for the clarification!

Am I understand it correctly:

For CustomAlerts, a design matches any of the substructure SMARTS pattern, it will be excluded immediately for any subsequence scoring.

For MatchingSubstructure, depends on how the transform is setup, it can be either a penalty or reward. For example, the following toml setup will penalize the matching of "CO" by zeroing the score if any CO is found in the design:

[[scoring.component]]
[scoring.component.MatchingSubstructure]
[[scoring.component.MatchingSubstructure.endpoint]]
name = "Matching SMARTs substructure"
weight = 1
params.smarts = "CO"

transform.type = "reverse_sigmoid"
transform.high = 3
transform.low = 1
transform.k = 0.5

while removing the transform section will turn it to a reward.

@halx
Copy link
Contributor

halx commented May 24, 2024

Hi again,

Yes, CustomAlerts is a filter and that is how a filter is supposed to work i.e. avoid unnecessary calculation if you already know that the total score will be zero.

You can transform any component, so also MatchingSubstructure, but a sigmoid may not be that ideal as you would have to find out how the two only values, 1.0 and 0.5, would best reverse map. We will update the value mapping transform to handle this better.

Cheers,
Hannes.

@frank-stonybrook
Copy link
Author

Thanks for the detailed explanation!

@halx
Copy link
Contributor

halx commented May 30, 2024

I just realize that you should also be able to use the left step transform with a lower value, say 0.5, to invert a binary input.

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

No branches or pull requests

2 participants