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

Missing Scalar Rules #100

Closed
3 of 6 tasks
oxinabox opened this issue Sep 5, 2019 · 6 comments · Fixed by #277
Closed
3 of 6 tasks

Missing Scalar Rules #100

oxinabox opened this issue Sep 5, 2019 · 6 comments · Fixed by #277
Labels
Milestone

Comments

@oxinabox
Copy link
Member

oxinabox commented Sep 5, 2019

We have a lot of scalar rules
A few I know are still missing

Zero everywhere it is differentiable

Idk if we want to close over the point gsps. (We do that for abs)

@oxinabox oxinabox added the good first issue Good for newcomers label Sep 5, 2019
@nickrobinson251 nickrobinson251 added this to the v1 milestone Oct 29, 2019
@oxinabox
Copy link
Member Author

oxinabox commented Jan 4, 2020

Arguably, we want to replace anywhere the derivative is not defined with Zero() or 0.0, if 0.0 is in the subgradient at that point.
Which is the case for things like abs and step functions

@freemin7
Copy link

freemin7 commented Apr 17, 2020

No guarantees:

@scalar_rule(clamp(x,low,high), 
  if x < low
     (Zero(),One(),Zero())
  elseif high < x
     (Zero(), Zero(), One())
  else
     (One(),Zero(),Zero())
  end
)
@scalar_rule(ldexp(x, y), (2^y, Ω*log(2))

Poly gamma seems to be already implemented

@willtebbutt
Copy link
Member

@freemin7 if you wouldn't mind turning the above into a PR, that would be fantastic.

@freemin7
Copy link

I will turn it into a PR

@freemin7
Copy link

See #173
I am not happy with the testing situation. As i found no way to test ldexp as the second argument is enforced to be an Integer which then obviously has no derivative. An Integrator based test would have no problems with discontinuities like that.

Clamp's derivative is undefined at high and low and i had to do a rewrite of my code to satisfy the macro gods.

@oxinabox
Copy link
Member Author

Clamp's derivative is undefined at high and low

It is zero? It is undefined at the edge but we can just chose it to be zero there which is correct enough for anything using subgradients.
Where ever gradient is undefined at a point, and either one side is zero, or sides have opposite sign then can fill the point discontinuality with zero and all is well.

and i had to do a rewrite of my code to satisfy the macro gods.

You do not have to use the macro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants