Skip to content

Better error message for bad loss function #982

@MilesCranmer

Description

@MilesCranmer

When I try precomputing data rankings and then fitting a model using [incorrect API]

loss_function = """
begin
       using Statistics
       function loss_function(prediction, target)
           return 1 - cor(prediction, target)
       end
   end
"""

I run into the very long Julia error

Originally posted by @Waswas321123 in #981 (reply in thread)

Would be nice if the error message was better here. Rather than a MethodError we could
test the loss function earlier and validate it. Especially for Python users who might not understand it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions