Skip to content

Support for piecewise functions #531

@thowell

Description

@thowell

Is it possible to use this package with piecewise functions (e.g., Huber loss)?

@variables a
function huber(a)
    δ = 1.0
    if abs(a) <= δ
        return 0.5*a^2
    else
        return δ*(abs(a) - 0.5*δ)
    end
end
da = huber(a)

This errors on the last line:

TypeError: non-boolean (Operation) used in boolean context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions