As discussed in the meeting, here is the implementation of the single-variable RBF PQK derivatives.
It includes 3 relevant additions:
evaluate_string_derivatives: given an evaluation string (i.e "dKdx", ...) returns the corresponding matrix
evaluate_derivatives: calls evaluate_string_derivative, checks caching and returns a dictionary (loosely based on LowLevelPennylane.evaluate )
GaussianOuterKernel.dKdx, GaussianOuterKernel.dKdy, GaussianOuterKernel.dKdxdx,GaussianOuterKernel.dKdxdy: the analytical derivatives of the RBF
About notation:
In the implementation of evaluate_string_derivatives, O correspond to the array of expectation values of the observables that go into the PQK, in the squlearn documentation of the PQK this is refered to as QNN(x). Perhaps, a better name instead of O would be good :) (pylint also did not like this name)
About the correctness:
I have numerically benchmarked with an analytical example evaluate_derivatives for dKdx, dKdy, dKdxdx, dKdxdy, so they should be correctly implemented. I have not benchmarked yet dKdp (as I have not used it for any ODE). In summary, the status of the implemented derivatives is:
1D variable:
Implemented and numerically benchmarked: dKdx, dKdy, dKdxdx
Implemented, not yet numerically benchmarked: dKdp
Not Implemented: dKdop, (more ?)
Multidimensional variable:
Implemented and numerically benchmarked: dKdx, dKdy
Not Implemented: dKdxdx, dKdxdy, dKdop, dKdp (more ?)
I am very happy and grateful to receive your feedback to improve the implementation. 🙏 🚀
Thank you very much for your help!
In case someone wants to double check the derivation, see screenshot.
Hi!
As discussed in the meeting, here is the implementation of the single-variable RBF PQK derivatives.
It includes 3 relevant additions:
evaluate_string_derivatives
: given an evaluation string (i.e "dKdx", ...) returns the corresponding matrixevaluate_derivatives
: callsevaluate_string_derivative
, checks caching and returns a dictionary (loosely based onLowLevelPennylane.evaluate
)GaussianOuterKernel.dKdx
,GaussianOuterKernel.dKdy
,GaussianOuterKernel.dKdxdx,
GaussianOuterKernel.dKdxdy
: the analytical derivatives of the RBFAbout notation:
In the implementation of
evaluate_string_derivatives
,O
correspond to the array of expectation values of the observables that go into the PQK, in the squlearn documentation of the PQK this is refered to as QNN(x). Perhaps, a better name instead ofO
would be good :) (pylint also did not like this name)About the correctness:
I have numerically benchmarked with an analytical example
evaluate_derivatives
for dKdx, dKdy, dKdxdx, dKdxdy, so they should be correctly implemented. I have not benchmarked yet dKdp (as I have not used it for any ODE). In summary, the status of the implemented derivatives is:1D variable:
Multidimensional variable:
I am very happy and grateful to receive your feedback to improve the implementation. 🙏 🚀
Thank you very much for your help!
In case someone wants to double check the derivation, see screenshot.