Skip to content

Docs: Explain problem types (AggregationLevel) in the docs #595

@hamogu

Description

@hamogu

In the docs, the How to write objective functions section has this intriguing sentence:

To use least-squares optimizers in optimagic, you need to mark your function with a decorator and return the least-squares residuals instead of the aggregated function value.

However, there is no more detail what this does and what it's good for. So, I decided to start reading the code and found that it's an AggregationLevel, but, going back to the docs (as a user, I try to avoid spending too much time to read the code to find out what it does), AggregationLevel is only mentioned in passing in an example with the note "the type of problem this optimizer can solve -> scalar problems; Other optimizers solve likelihood or least_squares problems."

At this point, at least I found that there are in fact three Aggregationlevels: scalar, likelihood, and least-squares.

Some of my objective functions will have a least-square structure, others are log-likehoods, so I wonder if I should mark those. I don't think this needs separate examples, a short (1-3 sentence each) explanation in the docs about the following would suffice:

  • What is the purpose of setting those levels / use the decorators to mark objective functions (as far as I've found out so far, they change the return format expected from the objective function (scalar vs. array) and also the penalty function)?
  • E.g. for the likelihood, do you expect the objective function to return a number or an array? The summed log-likelihood? A positive or negative number (in my field people commonly use the negative log-likelihood, because then you can call common minimizers and don't have to worry about "maximizers")?
  • Similar 1-2 sentences for scalar and least-square.

A good place for that might be in the "How to write an objective function" guide, but it could also live in the API docs, if it's called out in the objective function guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions