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

Flatten objectives #16

Merged
merged 6 commits into from
Oct 18, 2024
Merged

Flatten objectives #16

merged 6 commits into from
Oct 18, 2024

Conversation

alex404
Copy link
Contributor

@alex404 alex404 commented Oct 17, 2024

Flattened objective hierarchy so that it's no longer "Goal -> Objective -> Loss" and just "Objective -> Loss". Losses now contain a list of target circuits and weights. Overall seems to be a bit more performant because we're not doing as many loops over the AD graph. Configs updated accordingly.

Resolves #8

alex404 and others added 6 commits October 16, 2024 17:54
docstrings optional. A good type system should do most of the work, and
doc strings fill in the rest (where necessary).
plots. Also here and there stripping about excessive documentation.
Trying to see if I can do something useful with the graph plot.
@alex404 alex404 requested a review from fabioseel October 17, 2024 14:07
Copy link
Contributor

@fabioseel fabioseel left a comment

Choose a reason for hiding this comment

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

Overall I think for meaningful review we should strive for "smaller" and more concise pull requests, as quite a lot has changed here

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should decide on ruff vs pylint now, else we also have to maintain this rule checking for both equally etc :D
I don't have a strong opinion on it, but if ruff integrates nicer in your IDE we can use that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have a strong opinion either, but I think the main thing is making sure we only have to track one set of such things in ruff. Maybe I'd say if you'd like me to take care of it, then I'll manage the ruff/toml stuff. If you care about extra pylint features though, then it's up to you to maintain it in toml, so that I can then get the desired behaviour.

- brain_optimizer: The BrainOptimizer instance

"""
def plot_brain_and_optimizers(brain: Brain, objective: Objective[ContextT]) -> Figure:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the one line comment you added to the other functions would be nice here as well as the function name is not fully explaining what to expect

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is my strategy. I'm actually not deleting as many comments as I thought I would. I've removed the warning, but wherever a one liner of comment would be helpful I leave it/add it.

@alex404
Copy link
Contributor Author

alex404 commented Oct 18, 2024

Overall I think for meaningful review we should strive for "smaller" and more concise pull requests, as quite a lot has changed here

Okay I'll try and keep that in mind. You'll probably not going to like my next pull request though...

@alex404
Copy link
Contributor Author

alex404 commented Oct 18, 2024

If you'd prefer to have smaller merges (which I think can make sense) maybe I'd reactivate the project interface. Then basically we keep it as a big list of todos. When a checklist item gets mature enough, we turn it into an issue, and then address it with a merge. Would you prefer that strategy?

Otherwise my current strategy is making thematically organized todos under issues, and addressing them in bulk. Currently I'm working on #11, which again will have a large number of changes.

@alex404 alex404 merged commit 5ea0208 into master Oct 18, 2024
1 of 3 checks passed
@alex404 alex404 deleted the flatten-objectives branch October 18, 2024 10:40
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.

Flatten structure of objective class
2 participants