-
Notifications
You must be signed in to change notification settings - Fork 563
Mean and kernel functions for first and second derivatives #2235
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
Conversation
…ested more rigorously.
…t and second (non-mixed) derivatives
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly looks good! Diag should be implemented though.
There are linting errors - can you make sure that you pass the precommit hooks (see our contribution guidelines in the readme).
Additionally, please make sure that you add this kernel and these means to the documentation, and be sure that the docs compile for you locally (without warnings).
Thanks @ankushaggarwal !
Thanks @
Thanks @gpleiss I have made hook fixes using pre-commit and added the new kernel and means to the doc files. However I cannot compile them locally (I am getting different errors, such as version.py not found etc. I have implemented the diagonal option. |
…st_shapes as per the new gpytorch version
This reverts commit 451dfd1.
.pre-commit-config.yaml
Outdated
@@ -1,6 +1,6 @@ | |||
repos: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind splitting out the hook update into a separate PR? It's good practice and easier to figure out if things go wrong if this is not intermingled with feature additions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we need to change the pre-commit-hooks
file at all. Can we get rid of these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, removed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have implemented the diag option for rbf_kernel_gradgrad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding the diag
functionality, but this PR still needs unit tests. Please also add docstrings and type hints to all new classes and methods.
.pre-commit-config.yaml
Outdated
@@ -1,6 +1,6 @@ | |||
repos: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we need to change the pre-commit-hooks
file at all. Can we get rid of these changes?
This kernel does not have an `outputscale` parameter. To add a scaling parameter, | ||
decorate this kernel with a :class:`gpytorch.kernels.ScaleKernel`. | ||
|
||
Args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the doc string to be in the standard sphinx format? (See the Kernel base class for an example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
||
|
||
class ConstantMeanGradGrad(Mean): | ||
def __init__(self, prior=None, batch_shape=torch.Size(), **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a doc string and type hints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
gpytorch/means/linear_mean_grad.py
Outdated
|
||
|
||
class LinearMeanGrad(Mean): | ||
def __init__(self, input_size, batch_shape=torch.Size(), bias=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc string and type hints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
|
||
|
||
class LinearMeanGradGrad(Mean): | ||
def __init__(self, input_size, batch_shape=torch.Size(), bias=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc string and type hints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
Thanks @ankushaggarwal ! |
Added new classes to work with derivatives:
a. ConstantMeanGradGrad
b. LinearMeanGrad
c. LinearMeanGradGrad