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

Adding functions that work with @contractor #169

Open
MartinDAndersson opened this issue Oct 24, 2020 · 4 comments
Open

Adding functions that work with @contractor #169

MartinDAndersson opened this issue Oct 24, 2020 · 4 comments

Comments

@MartinDAndersson
Copy link

I am wondering if there is a way to add new functions (functions that are not composed of the regular ones already in src) that the @constraint macro can handle? For instance, I am interested in neural networks, and would like to have constraints using the ReLU function (g(x) = x ? x \geq 0 : 0), but the @function macro does not seem to handle conditionals. It would be nice if I can somehow add ReLU, providing forward and backwards code for the contraction step. Is there some way to do this?

@dpsanders
Copy link
Member

Sorry I missed this.

I think you can write ReLU in terms of abs, floor etc. that are already implemented?

Conditionals are not possible with interval methods, but we should be able to simulate them with piecewise functions.

@MartinDAndersson
Copy link
Author

Yes, thank you! I also realized I could just use f(x) = max(0,x) in this particular case.

@dpsanders
Copy link
Member

(Piecewise functions have been added to IntervalArithmetic, but we have not yet implemented reverse functions for them.)

@dpsanders
Copy link
Member

Moving forward this will need to be done via ReversePropagation.jl.

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